diff --git a/package.json b/package.json index f693c27f1..721dc662c 100644 --- a/package.json +++ b/package.json @@ -35,19 +35,19 @@ "runkitExampleFilename": "./docs/examples/ping.js", "unpkg": "./webpack/discord.min.js", "dependencies": { - "@discordjs/collection": "^0.1.1", + "@discordjs/collection": "^0.1.5", "abort-controller": "^3.0.0", - "form-data": "^2.3.3", - "node-fetch": "^2.3.0", - "prism-media": "^1.0.0", + "form-data": "^3.0.0", + "node-fetch": "^2.6.0", + "prism-media": "^1.2.0", "setimmediate": "^1.0.5", - "tweetnacl": "^1.0.1", - "ws": "^7.2.0" + "tweetnacl": "^1.0.3", + "ws": "^7.2.1" }, "peerDependencies": { "bufferutil": "^4.0.1", "erlpack": "discordapp/erlpack", - "libsodium-wrappers": "^0.7.4", + "libsodium-wrappers": "^0.7.6", "sodium": "^3.0.2", "utf-8-validate": "^5.0.2", "zlib-sync": "^0.1.6" @@ -74,20 +74,20 @@ }, "devDependencies": { "@types/node": "^10.12.24", - "@types/ws": "^6.0.1", + "@types/ws": "^7.2.1", "discord.js-docgen": "discordjs/docgen", "dtslint": "^3.0.0", - "eslint": "^5.13.0", - "jest": "^24.7.1", + "eslint": "^6.8.0", + "jest": "^25.1.0", "json-filter-loader": "^1.0.0", "terser-webpack-plugin": "^1.2.2", - "tslint": "^5.12.1", - "typescript": "^3.3.3", - "webpack": "^4.29.3", - "webpack-cli": "^3.2.3" + "tslint": "^6.0.0", + "typescript": "^3.8.2", + "webpack": "^4.41.6", + "webpack-cli": "^3.3.11" }, "engines": { - "node": ">=11.0.0" + "node": ">=12.0.0" }, "browser": { "@discordjs/opus": false, diff --git a/src/client/voice/util/VolumeInterface.js b/src/client/voice/util/VolumeInterface.js index ba162a947..179d4fb78 100644 --- a/src/client/voice/util/VolumeInterface.js +++ b/src/client/voice/util/VolumeInterface.js @@ -106,7 +106,7 @@ exports.applyToClass = function applyToClass(structure) { Object.defineProperty( structure.prototype, prop, - Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop) + Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop), ); } }; diff --git a/src/client/websocket/handlers/GUILD_CREATE.js b/src/client/websocket/handlers/GUILD_CREATE.js index eb8974435..9994d9f84 100644 --- a/src/client/websocket/handlers/GUILD_CREATE.js +++ b/src/client/websocket/handlers/GUILD_CREATE.js @@ -11,7 +11,7 @@ module.exports = async (client, { d: data }, shard) => { // If the client was ready before and we had unavailable guilds, fetch them if (client.ws.status === Status.READY && client.options.fetchAllMembers) { await guild.members.fetch().catch(err => - client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`) + client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`), ); } } @@ -27,7 +27,7 @@ module.exports = async (client, { d: data }, shard) => { */ if (client.options.fetchAllMembers) { await guild.members.fetch().catch(err => - client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`) + client.emit(Events.DEBUG, `Failed to fetch all members: ${err}\n${err.stack}`), ); } client.emit(Events.GUILD_CREATE, guild); diff --git a/src/rest/RequestHandler.js b/src/rest/RequestHandler.js index 8f650b42a..8a8ecf9a7 100644 --- a/src/rest/RequestHandler.js +++ b/src/rest/RequestHandler.js @@ -103,7 +103,7 @@ class RequestHandler { // NodeFetch error expected for all "operational" errors, such as 500 status code this.busy = false; return reject( - new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path) + new HTTPError(error.message, error.constructor.name, error.status, request.method, request.path), ); } @@ -155,7 +155,7 @@ class RequestHandler { // Retry the specified number of times for possible serverside issues if (item.retries === this.manager.client.options.retryLimit) { return reject( - new HTTPError(res.statusText, res.constructor.name, res.status, item.request.method, request.path) + new HTTPError(res.statusText, res.constructor.name, res.status, item.request.method, request.path), ); } else { item.retries++; @@ -172,7 +172,7 @@ class RequestHandler { return null; } catch (err) { return reject( - new HTTPError(err.message, err.constructor.name, err.status, request.method, request.path) + new HTTPError(err.message, err.constructor.name, err.status, request.method, request.path), ); } } diff --git a/src/sharding/Shard.js b/src/sharding/Shard.js index 04d224db4..7e016fbee 100644 --- a/src/sharding/Shard.js +++ b/src/sharding/Shard.js @@ -294,7 +294,7 @@ class Shard extends EventEmitter { if (message._sFetchProp) { this.manager.fetchClientValues(message._sFetchProp).then( results => this.send({ _sFetchProp: message._sFetchProp, _result: results }), - err => this.send({ _sFetchProp: message._sFetchProp, _error: Util.makePlainError(err) }) + err => this.send({ _sFetchProp: message._sFetchProp, _error: Util.makePlainError(err) }), ); return; } @@ -303,7 +303,7 @@ class Shard extends EventEmitter { if (message._sEval) { this.manager.broadcastEval(message._sEval).then( results => this.send({ _sEval: message._sEval, _result: results }), - err => this.send({ _sEval: message._sEval, _error: Util.makePlainError(err) }) + err => this.send({ _sEval: message._sEval, _error: Util.makePlainError(err) }), ); return; } diff --git a/src/structures/Guild.js b/src/structures/Guild.js index fc04530c9..9353f4de5 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -616,7 +616,7 @@ class Guild extends Base { user: this.client.users.add(ban.user), }); return collection; - }, new Collection()) + }, new Collection()), ); } @@ -634,7 +634,7 @@ class Guild extends Base { return this.client.api.guilds(this.id).integrations.get().then(data => data.reduce((collection, integration) => collection.set(integration.id, new Integration(this.client, integration, this)), - new Collection()) + new Collection()), ); } @@ -1086,7 +1086,7 @@ class Guild extends Base { this.client.actions.GuildChannelsPositionUpdate.handle({ guild_id: this.id, channels: updatedChannels, - }).guild + }).guild, ); } @@ -1120,7 +1120,7 @@ class Guild extends Base { this.client.actions.GuildRolePositionUpdate.handle({ guild_id: this.id, roles: rolePositions, - }).guild + }).guild, ); } @@ -1250,7 +1250,7 @@ class Guild extends Base { _sortedChannels(channel) { const category = channel.type === ChannelTypes.CATEGORY; return Util.discordSort(this.channels.cache.filter(c => - c.type === channel.type && (category || c.parent === channel.parent) + c.type === channel.type && (category || c.parent === channel.parent), )); } } diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 649e5b222..35a0bc2ab 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -375,6 +375,7 @@ class GuildChannel extends Channel { */ setParent(channel, { lockPermissions = true, reason } = {}) { return this.edit({ + // eslint-disable-next-line no-prototype-builtins parentID: channel !== null ? channel.hasOwnProperty('id') ? channel.id : channel : null, lockPermissions, }, reason); diff --git a/src/structures/Message.js b/src/structures/Message.js index 0c856fdae..d32e1c017 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -108,7 +108,7 @@ class Message extends Base { if (data.attachments) { for (const attachment of data.attachments) { this.attachments.set(attachment.id, new MessageAttachment( - attachment.url, attachment.filename, attachment + attachment.url, attachment.filename, attachment, )); } } @@ -230,7 +230,7 @@ class Message extends Base { this.attachments = new Collection(); for (const attachment of data.attachments) { this.attachments.set(attachment.id, new MessageAttachment( - attachment.url, attachment.filename, attachment + attachment.url, attachment.filename, attachment, )); } } else { @@ -242,7 +242,7 @@ class Message extends Base { 'mentions' in data ? data.mentions : this.mentions.users, 'mentions_roles' in data ? data.mentions_roles : this.mentions.roles, 'mention_everyone' in data ? data.mention_everyone : this.mentions.everyone, - 'mention_channels' in data ? data.mention_channels : this.mentions.crosspostedChannels + 'mention_channels' in data ? data.mention_channels : this.mentions.crosspostedChannels, ); this.flags = new MessageFlags('flags' in data ? data.flags : 0).freeze(); @@ -511,7 +511,7 @@ class Message extends Base { reply(content, options) { return this.channel.send(content instanceof APIMessage ? content : - APIMessage.transformOptions(content, options, { reply: this.member || this.author }) + APIMessage.transformOptions(content, options, { reply: this.member || this.author }), ); } diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index 4106e00df..0fe0e2dca 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -300,7 +300,7 @@ class TextBasedChannel { let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id || m); if (filterOld) { messageIDs = messageIDs.filter(id => - Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000 + Date.now() - Snowflake.deconstruct(id).date.getTime() < 1209600000, ); } if (messageIDs.length === 0) return new Collection(); @@ -336,7 +336,7 @@ class TextBasedChannel { 'typing', 'typingCount', 'createMessageCollector', - 'awaitMessages' + 'awaitMessages', ); } for (const prop of props) { diff --git a/src/util/Snowflake.js b/src/util/Snowflake.js index 06612c30b..71090adc0 100644 --- a/src/util/Snowflake.js +++ b/src/util/Snowflake.js @@ -36,7 +36,7 @@ class SnowflakeUtil { if (timestamp instanceof Date) timestamp = timestamp.getTime(); if (typeof timestamp !== 'number' || isNaN(timestamp)) { throw new TypeError( - `"timestamp" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})` + `"timestamp" argument must be a number (received ${isNaN(timestamp) ? 'NaN' : typeof timestamp})`, ); } if (INCREMENT >= 4095) INCREMENT = 0; diff --git a/src/util/Structures.js b/src/util/Structures.js index c4061f62c..fdbab0697 100644 --- a/src/util/Structures.js +++ b/src/util/Structures.js @@ -45,7 +45,7 @@ class Structures { if (typeof extender !== 'function') { const received = `(received ${typeof extender})`; throw new TypeError( - `"extender" argument must be a function that returns the extended structure class/prototype ${received}.` + `"extender" argument must be a function that returns the extended structure class/prototype ${received}.`, ); } @@ -60,7 +60,7 @@ class Structures { const received = `${extended.name || 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`; throw new Error( 'The class/prototype returned from the extender function must extend the existing structure class/prototype' + - ` (received function ${received}; expected extension of ${structures[structure].name}).` + ` (received function ${received}; expected extension of ${structures[structure].name}).`, ); } diff --git a/src/util/Util.js b/src/util/Util.js index 4ab518773..6e878f34e 100644 --- a/src/util/Util.js +++ b/src/util/Util.js @@ -437,7 +437,7 @@ class Util { return collection.sorted((a, b) => a.rawPosition - b.rawPosition || parseInt(b.id.slice(0, -10)) - parseInt(a.id.slice(0, -10)) || - parseInt(b.id.slice(10)) - parseInt(a.id.slice(10)) + parseInt(b.id.slice(10)) - parseInt(a.id.slice(10)), ); }