chore(deps): update deps and fix lint (#3833)

This commit is contained in:
Crawl
2020-02-24 23:14:31 +01:00
committed by GitHub
parent c1d396a6c4
commit 3a0470b45c
12 changed files with 39 additions and 38 deletions

View File

@@ -35,19 +35,19 @@
"runkitExampleFilename": "./docs/examples/ping.js", "runkitExampleFilename": "./docs/examples/ping.js",
"unpkg": "./webpack/discord.min.js", "unpkg": "./webpack/discord.min.js",
"dependencies": { "dependencies": {
"@discordjs/collection": "^0.1.1", "@discordjs/collection": "^0.1.5",
"abort-controller": "^3.0.0", "abort-controller": "^3.0.0",
"form-data": "^2.3.3", "form-data": "^3.0.0",
"node-fetch": "^2.3.0", "node-fetch": "^2.6.0",
"prism-media": "^1.0.0", "prism-media": "^1.2.0",
"setimmediate": "^1.0.5", "setimmediate": "^1.0.5",
"tweetnacl": "^1.0.1", "tweetnacl": "^1.0.3",
"ws": "^7.2.0" "ws": "^7.2.1"
}, },
"peerDependencies": { "peerDependencies": {
"bufferutil": "^4.0.1", "bufferutil": "^4.0.1",
"erlpack": "discordapp/erlpack", "erlpack": "discordapp/erlpack",
"libsodium-wrappers": "^0.7.4", "libsodium-wrappers": "^0.7.6",
"sodium": "^3.0.2", "sodium": "^3.0.2",
"utf-8-validate": "^5.0.2", "utf-8-validate": "^5.0.2",
"zlib-sync": "^0.1.6" "zlib-sync": "^0.1.6"
@@ -74,20 +74,20 @@
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^10.12.24", "@types/node": "^10.12.24",
"@types/ws": "^6.0.1", "@types/ws": "^7.2.1",
"discord.js-docgen": "discordjs/docgen", "discord.js-docgen": "discordjs/docgen",
"dtslint": "^3.0.0", "dtslint": "^3.0.0",
"eslint": "^5.13.0", "eslint": "^6.8.0",
"jest": "^24.7.1", "jest": "^25.1.0",
"json-filter-loader": "^1.0.0", "json-filter-loader": "^1.0.0",
"terser-webpack-plugin": "^1.2.2", "terser-webpack-plugin": "^1.2.2",
"tslint": "^5.12.1", "tslint": "^6.0.0",
"typescript": "^3.3.3", "typescript": "^3.8.2",
"webpack": "^4.29.3", "webpack": "^4.41.6",
"webpack-cli": "^3.2.3" "webpack-cli": "^3.3.11"
}, },
"engines": { "engines": {
"node": ">=11.0.0" "node": ">=12.0.0"
}, },
"browser": { "browser": {
"@discordjs/opus": false, "@discordjs/opus": false,

View File

@@ -106,7 +106,7 @@ exports.applyToClass = function applyToClass(structure) {
Object.defineProperty( Object.defineProperty(
structure.prototype, structure.prototype,
prop, prop,
Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop) Object.getOwnPropertyDescriptor(VolumeInterface.prototype, prop),
); );
} }
}; };

View File

@@ -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 the client was ready before and we had unavailable guilds, fetch them
if (client.ws.status === Status.READY && client.options.fetchAllMembers) { if (client.ws.status === Status.READY && client.options.fetchAllMembers) {
await guild.members.fetch().catch(err => 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) { if (client.options.fetchAllMembers) {
await guild.members.fetch().catch(err => 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); client.emit(Events.GUILD_CREATE, guild);

View File

@@ -103,7 +103,7 @@ class RequestHandler {
// NodeFetch error expected for all "operational" errors, such as 500 status code // NodeFetch error expected for all "operational" errors, such as 500 status code
this.busy = false; this.busy = false;
return reject( 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 // Retry the specified number of times for possible serverside issues
if (item.retries === this.manager.client.options.retryLimit) { if (item.retries === this.manager.client.options.retryLimit) {
return reject( 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 { } else {
item.retries++; item.retries++;
@@ -172,7 +172,7 @@ class RequestHandler {
return null; return null;
} catch (err) { } catch (err) {
return reject( 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),
); );
} }
} }

View File

@@ -294,7 +294,7 @@ class Shard extends EventEmitter {
if (message._sFetchProp) { if (message._sFetchProp) {
this.manager.fetchClientValues(message._sFetchProp).then( this.manager.fetchClientValues(message._sFetchProp).then(
results => this.send({ _sFetchProp: message._sFetchProp, _result: results }), 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; return;
} }
@@ -303,7 +303,7 @@ class Shard extends EventEmitter {
if (message._sEval) { if (message._sEval) {
this.manager.broadcastEval(message._sEval).then( this.manager.broadcastEval(message._sEval).then(
results => this.send({ _sEval: message._sEval, _result: results }), 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; return;
} }

View File

@@ -616,7 +616,7 @@ class Guild extends Base {
user: this.client.users.add(ban.user), user: this.client.users.add(ban.user),
}); });
return collection; 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 => return this.client.api.guilds(this.id).integrations.get().then(data =>
data.reduce((collection, integration) => data.reduce((collection, integration) =>
collection.set(integration.id, new Integration(this.client, integration, this)), 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({ this.client.actions.GuildChannelsPositionUpdate.handle({
guild_id: this.id, guild_id: this.id,
channels: updatedChannels, channels: updatedChannels,
}).guild }).guild,
); );
} }
@@ -1120,7 +1120,7 @@ class Guild extends Base {
this.client.actions.GuildRolePositionUpdate.handle({ this.client.actions.GuildRolePositionUpdate.handle({
guild_id: this.id, guild_id: this.id,
roles: rolePositions, roles: rolePositions,
}).guild }).guild,
); );
} }
@@ -1250,7 +1250,7 @@ class Guild extends Base {
_sortedChannels(channel) { _sortedChannels(channel) {
const category = channel.type === ChannelTypes.CATEGORY; const category = channel.type === ChannelTypes.CATEGORY;
return Util.discordSort(this.channels.cache.filter(c => 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),
)); ));
} }
} }

View File

@@ -375,6 +375,7 @@ class GuildChannel extends Channel {
*/ */
setParent(channel, { lockPermissions = true, reason } = {}) { setParent(channel, { lockPermissions = true, reason } = {}) {
return this.edit({ return this.edit({
// eslint-disable-next-line no-prototype-builtins
parentID: channel !== null ? channel.hasOwnProperty('id') ? channel.id : channel : null, parentID: channel !== null ? channel.hasOwnProperty('id') ? channel.id : channel : null,
lockPermissions, lockPermissions,
}, reason); }, reason);

View File

@@ -108,7 +108,7 @@ class Message extends Base {
if (data.attachments) { if (data.attachments) {
for (const attachment of data.attachments) { for (const attachment of data.attachments) {
this.attachments.set(attachment.id, new MessageAttachment( 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(); this.attachments = new Collection();
for (const attachment of data.attachments) { for (const attachment of data.attachments) {
this.attachments.set(attachment.id, new MessageAttachment( this.attachments.set(attachment.id, new MessageAttachment(
attachment.url, attachment.filename, attachment attachment.url, attachment.filename, attachment,
)); ));
} }
} else { } else {
@@ -242,7 +242,7 @@ class Message extends Base {
'mentions' in data ? data.mentions : this.mentions.users, 'mentions' in data ? data.mentions : this.mentions.users,
'mentions_roles' in data ? data.mentions_roles : this.mentions.roles, 'mentions_roles' in data ? data.mentions_roles : this.mentions.roles,
'mention_everyone' in data ? data.mention_everyone : this.mentions.everyone, '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(); this.flags = new MessageFlags('flags' in data ? data.flags : 0).freeze();
@@ -511,7 +511,7 @@ class Message extends Base {
reply(content, options) { reply(content, options) {
return this.channel.send(content instanceof APIMessage ? return this.channel.send(content instanceof APIMessage ?
content : content :
APIMessage.transformOptions(content, options, { reply: this.member || this.author }) APIMessage.transformOptions(content, options, { reply: this.member || this.author }),
); );
} }

View File

@@ -300,7 +300,7 @@ class TextBasedChannel {
let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id || m); let messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id || m);
if (filterOld) { if (filterOld) {
messageIDs = messageIDs.filter(id => 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(); if (messageIDs.length === 0) return new Collection();
@@ -336,7 +336,7 @@ class TextBasedChannel {
'typing', 'typing',
'typingCount', 'typingCount',
'createMessageCollector', 'createMessageCollector',
'awaitMessages' 'awaitMessages',
); );
} }
for (const prop of props) { for (const prop of props) {

View File

@@ -36,7 +36,7 @@ class SnowflakeUtil {
if (timestamp instanceof Date) timestamp = timestamp.getTime(); if (timestamp instanceof Date) timestamp = timestamp.getTime();
if (typeof timestamp !== 'number' || isNaN(timestamp)) { if (typeof timestamp !== 'number' || isNaN(timestamp)) {
throw new TypeError( 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; if (INCREMENT >= 4095) INCREMENT = 0;

View File

@@ -45,7 +45,7 @@ class Structures {
if (typeof extender !== 'function') { if (typeof extender !== 'function') {
const received = `(received ${typeof extender})`; const received = `(received ${typeof extender})`;
throw new TypeError( 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}` : ''}`; const received = `${extended.name || 'unnamed'}${prototype.name ? ` extends ${prototype.name}` : ''}`;
throw new Error( throw new Error(
'The class/prototype returned from the extender function must extend the existing structure class/prototype' + '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}).`,
); );
} }

View File

@@ -437,7 +437,7 @@ class Util {
return collection.sorted((a, b) => return collection.sorted((a, b) =>
a.rawPosition - b.rawPosition || a.rawPosition - b.rawPosition ||
parseInt(b.id.slice(0, -10)) - parseInt(a.id.slice(0, -10)) || 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)),
); );
} }