From 90304aa7d6b99cf086720fadd4008efdae26916a Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Sat, 12 Nov 2016 20:52:37 -0500 Subject: [PATCH] Fix loads of JSDoc type issues --- .eslintrc.json | 8 +++++--- src/client/Client.js | 4 ++-- src/client/voice/VoiceConnection.js | 2 +- src/sharding/Shard.js | 2 +- src/sharding/ShardClientUtil.js | 2 +- src/structures/ClientOAuth2Application.js | 2 +- src/structures/EvaluatedPermissions.js | 2 +- src/structures/Guild.js | 2 +- src/structures/GuildChannel.js | 2 +- src/structures/GuildMember.js | 2 +- src/structures/Message.js | 2 +- src/structures/OAuth2Application.js | 2 +- src/util/Collection.js | 4 ++-- 13 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 2e3021ca0..f2babc118 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,17 +14,19 @@ "valid-jsdoc": ["error", { "requireReturn": false, "requireReturnDescription": false, + "prefer": { + "return": "returns", + "arg": "param" + }, "preferType": { "String": "string", "Number": "number", "Boolean": "boolean", "Function": "function", "object": "Object", + "array": "Array", "date": "Date", "error": "Error" - }, - "prefer": { - "return": "returns" } }], diff --git a/src/client/Client.js b/src/client/Client.js index 0b4cf17e5..b33fb2ab3 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -85,7 +85,7 @@ class Client extends EventEmitter { /** * The shard helpers for the client (only if the process was spawned as a child, such as from a ShardingManager) - * @type {?ShardUtil} + * @type {?ShardClientUtil} */ this.shard = process.send ? ShardClientUtil.singleton(this) : null; @@ -328,7 +328,7 @@ class Client extends EventEmitter { /** * Gets the bot's OAuth2 application. * This is only available when using a bot account. - * @returns {Promise} + * @returns {Promise} */ fetchApplication() { if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT); diff --git a/src/client/voice/VoiceConnection.js b/src/client/voice/VoiceConnection.js index 611ef6829..3bd88fafe 100644 --- a/src/client/voice/VoiceConnection.js +++ b/src/client/voice/VoiceConnection.js @@ -70,7 +70,7 @@ class VoiceConnection extends EventEmitter { /** * Warning info from the connection * @event VoiceConnection#warn - * @param {string|error} warning the warning + * @param {string|Error} warning the warning */ this.emit('warn', e); this.player.cleanup(); diff --git a/src/sharding/Shard.js b/src/sharding/Shard.js index ea48f4234..31cbb814d 100644 --- a/src/sharding/Shard.js +++ b/src/sharding/Shard.js @@ -10,7 +10,7 @@ class Shard { /** * @param {ShardingManager} manager The sharding manager * @param {number} id The ID of this shard - * @param {array} [args=[]] Command line arguments to pass to the script + * @param {Array} [args=[]] Command line arguments to pass to the script */ constructor(manager, id, args = []) { /** diff --git a/src/sharding/ShardClientUtil.js b/src/sharding/ShardClientUtil.js index 51c16fa8f..295b5fbcd 100644 --- a/src/sharding/ShardClientUtil.js +++ b/src/sharding/ShardClientUtil.js @@ -127,7 +127,7 @@ class ShardClientUtil { /** * Creates/gets the singleton of this class * @param {Client} client Client to use - * @returns {ShardUtil} + * @returns {ShardClientUtil} */ static singleton(client) { if (!this._singleton) { diff --git a/src/structures/ClientOAuth2Application.js b/src/structures/ClientOAuth2Application.js index 158d71a4f..46e125040 100644 --- a/src/structures/ClientOAuth2Application.js +++ b/src/structures/ClientOAuth2Application.js @@ -11,7 +11,7 @@ class ClientOAuth2Application extends OAuth2Application { /** * The app's flags - * @type {int} + * @type {number} */ this.flags = data.flags; diff --git a/src/structures/EvaluatedPermissions.js b/src/structures/EvaluatedPermissions.js index de92c10d7..ae8a643ce 100644 --- a/src/structures/EvaluatedPermissions.js +++ b/src/structures/EvaluatedPermissions.js @@ -57,7 +57,7 @@ class EvaluatedPermissions { * Checks whether the user has all specified permissions, and lists any missing permissions. * @param {PermissionResolvable[]} permissions The permissions to check for * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions - * @returns {array} + * @returns {PermissionResolvable[]} */ missingPermissions(permissions, explicit = false) { return permissions.filter(p => !this.hasPermission(p, explicit)); diff --git a/src/structures/Guild.js b/src/structures/Guild.js index ffbe580ca..9c58f82b9 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -418,7 +418,7 @@ class Guild { /** * Edit the AFK channel of the guild. - * @param {GuildChannelResolvable} afkChannel The new AFK channel + * @param {ChannelResolvable} afkChannel The new AFK channel * @returns {Promise} * @example * // edit the guild AFK channel diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index c384279ff..4a30d033c 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -235,7 +235,7 @@ class GuildChannel extends Channel { * @typedef {Object} InviteOptions * @property {boolean} [temporary=false] Whether the invite should kick users after 24hrs if they are not given a role * @property {number} [maxAge=0] Time in seconds the invite expires in - * @property {maxUses} [maxUses=0] Maximum amount of uses for this invite + * @property {number} [maxUses=0] Maximum amount of uses for this invite */ /** diff --git a/src/structures/GuildMember.js b/src/structures/GuildMember.js index 1bf0f8aa9..d0513031f 100644 --- a/src/structures/GuildMember.js +++ b/src/structures/GuildMember.js @@ -256,7 +256,7 @@ class GuildMember { * Checks whether the roles of the member allows them to perform specific actions, and lists any missing permissions. * @param {PermissionResolvable[]} permissions The permissions to check for * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions - * @returns {array} + * @returns {PermissionResolvable[]} */ missingPermissions(permissions, explicit = false) { return permissions.filter(p => !this.hasPermission(p, explicit)); diff --git a/src/structures/Message.js b/src/structures/Message.js index bd372b4eb..769787728 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -84,7 +84,7 @@ class Message { /** * A list of embeds in the message - e.g. YouTube Player - * @type {Embed[]} + * @type {MessageEmbed[]} */ this.embeds = data.embeds.map(e => new Embed(this, e)); diff --git a/src/structures/OAuth2Application.js b/src/structures/OAuth2Application.js index 9969c8ed6..1bd740b1c 100644 --- a/src/structures/OAuth2Application.js +++ b/src/structures/OAuth2Application.js @@ -46,7 +46,7 @@ class OAuth2Application { /** * The app's RPC origins - * @type {Array} + * @type {Array} */ this.rpcOrigins = data.rpc_origins; } diff --git a/src/util/Collection.js b/src/util/Collection.js index a6b7bf856..b031f896c 100644 --- a/src/util/Collection.js +++ b/src/util/Collection.js @@ -107,7 +107,7 @@ class Collection extends Map { * Returns an array of items where `item[prop] === value` of the collection * @param {string} prop The property to test against * @param {*} value The expected value - * @returns {array} + * @returns {Array} * @example * collection.findAll('username', 'Bob'); */ @@ -237,7 +237,7 @@ class Collection extends Map { * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). * @param {function} fn Function that produces an element of the new array, taking three arguments * @param {*} [thisArg] Value to use as `this` when executing function - * @returns {array} + * @returns {Array} */ map(fn, thisArg) { if (thisArg) fn = fn.bind(thisArg);