Fix loads of JSDoc type issues

This commit is contained in:
Schuyler Cebulskie
2016-11-12 20:52:37 -05:00
parent 318bb52c36
commit 90304aa7d6
13 changed files with 19 additions and 17 deletions

View File

@@ -14,17 +14,19 @@
"valid-jsdoc": ["error", { "valid-jsdoc": ["error", {
"requireReturn": false, "requireReturn": false,
"requireReturnDescription": false, "requireReturnDescription": false,
"prefer": {
"return": "returns",
"arg": "param"
},
"preferType": { "preferType": {
"String": "string", "String": "string",
"Number": "number", "Number": "number",
"Boolean": "boolean", "Boolean": "boolean",
"Function": "function", "Function": "function",
"object": "Object", "object": "Object",
"array": "Array",
"date": "Date", "date": "Date",
"error": "Error" "error": "Error"
},
"prefer": {
"return": "returns"
} }
}], }],

View File

@@ -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) * 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; this.shard = process.send ? ShardClientUtil.singleton(this) : null;
@@ -328,7 +328,7 @@ class Client extends EventEmitter {
/** /**
* Gets the bot's OAuth2 application. * Gets the bot's OAuth2 application.
* <warn>This is only available when using a bot account.</warn> * <warn>This is only available when using a bot account.</warn>
* @returns {Promise<ClientOAuth2App>} * @returns {Promise<ClientOAuth2Application>}
*/ */
fetchApplication() { fetchApplication() {
if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT); if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT);

View File

@@ -70,7 +70,7 @@ class VoiceConnection extends EventEmitter {
/** /**
* Warning info from the connection * Warning info from the connection
* @event VoiceConnection#warn * @event VoiceConnection#warn
* @param {string|error} warning the warning * @param {string|Error} warning the warning
*/ */
this.emit('warn', e); this.emit('warn', e);
this.player.cleanup(); this.player.cleanup();

View File

@@ -10,7 +10,7 @@ class Shard {
/** /**
* @param {ShardingManager} manager The sharding manager * @param {ShardingManager} manager The sharding manager
* @param {number} id The ID of this shard * @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 = []) { constructor(manager, id, args = []) {
/** /**

View File

@@ -127,7 +127,7 @@ class ShardClientUtil {
/** /**
* Creates/gets the singleton of this class * Creates/gets the singleton of this class
* @param {Client} client Client to use * @param {Client} client Client to use
* @returns {ShardUtil} * @returns {ShardClientUtil}
*/ */
static singleton(client) { static singleton(client) {
if (!this._singleton) { if (!this._singleton) {

View File

@@ -11,7 +11,7 @@ class ClientOAuth2Application extends OAuth2Application {
/** /**
* The app's flags * The app's flags
* @type {int} * @type {number}
*/ */
this.flags = data.flags; this.flags = data.flags;

View File

@@ -57,7 +57,7 @@ class EvaluatedPermissions {
* Checks whether the user has all specified permissions, and lists any missing permissions. * Checks whether the user has all specified permissions, and lists any missing permissions.
* @param {PermissionResolvable[]} permissions The permissions to check for * @param {PermissionResolvable[]} permissions The permissions to check for
* @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions
* @returns {array} * @returns {PermissionResolvable[]}
*/ */
missingPermissions(permissions, explicit = false) { missingPermissions(permissions, explicit = false) {
return permissions.filter(p => !this.hasPermission(p, explicit)); return permissions.filter(p => !this.hasPermission(p, explicit));

View File

@@ -418,7 +418,7 @@ class Guild {
/** /**
* Edit the AFK channel of the guild. * Edit the AFK channel of the guild.
* @param {GuildChannelResolvable} afkChannel The new AFK channel * @param {ChannelResolvable} afkChannel The new AFK channel
* @returns {Promise<Guild>} * @returns {Promise<Guild>}
* @example * @example
* // edit the guild AFK channel * // edit the guild AFK channel

View File

@@ -235,7 +235,7 @@ class GuildChannel extends Channel {
* @typedef {Object} InviteOptions * @typedef {Object} InviteOptions
* @property {boolean} [temporary=false] Whether the invite should kick users after 24hrs if they are not given a role * @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 {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
*/ */
/** /**

View File

@@ -256,7 +256,7 @@ class GuildMember {
* Checks whether the roles of the member allows them to perform specific actions, and lists any missing permissions. * 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 {PermissionResolvable[]} permissions The permissions to check for
* @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions
* @returns {array} * @returns {PermissionResolvable[]}
*/ */
missingPermissions(permissions, explicit = false) { missingPermissions(permissions, explicit = false) {
return permissions.filter(p => !this.hasPermission(p, explicit)); return permissions.filter(p => !this.hasPermission(p, explicit));

View File

@@ -84,7 +84,7 @@ class Message {
/** /**
* A list of embeds in the message - e.g. YouTube Player * 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)); this.embeds = data.embeds.map(e => new Embed(this, e));

View File

@@ -46,7 +46,7 @@ class OAuth2Application {
/** /**
* The app's RPC origins * The app's RPC origins
* @type {Array<String>} * @type {Array<string>}
*/ */
this.rpcOrigins = data.rpc_origins; this.rpcOrigins = data.rpc_origins;
} }

View File

@@ -107,7 +107,7 @@ class Collection extends Map {
* Returns an array of items where `item[prop] === value` of the collection * Returns an array of items where `item[prop] === value` of the collection
* @param {string} prop The property to test against * @param {string} prop The property to test against
* @param {*} value The expected value * @param {*} value The expected value
* @returns {array} * @returns {Array}
* @example * @example
* collection.findAll('username', 'Bob'); * 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). * [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 {function} fn Function that produces an element of the new array, taking three arguments
* @param {*} [thisArg] Value to use as `this` when executing function * @param {*} [thisArg] Value to use as `this` when executing function
* @returns {array} * @returns {Array}
*/ */
map(fn, thisArg) { map(fn, thisArg) {
if (thisArg) fn = fn.bind(thisArg); if (thisArg) fn = fn.bind(thisArg);