mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
Add new ESLint rules
This commit is contained in:
@@ -37,25 +37,26 @@ class DMChannel extends Channel {
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
send() { return; }
|
||||
sendMessage() { return; }
|
||||
sendEmbed() { return; }
|
||||
sendFile() { return; }
|
||||
sendFiles() { return; }
|
||||
sendCode() { return; }
|
||||
fetchMessage() { return; }
|
||||
fetchMessages() { return; }
|
||||
fetchPinnedMessages() { return; }
|
||||
search() { return; }
|
||||
startTyping() { return; }
|
||||
stopTyping() { return; }
|
||||
get typing() { return; }
|
||||
get typingCount() { return; }
|
||||
createCollector() { return; }
|
||||
awaitMessages() { return; }
|
||||
// doesn't work on DM channels; bulkDelete() { return; }
|
||||
acknowledge() { return; }
|
||||
_cacheMessage() { return; }
|
||||
/* eslint-disable no-empty-function */
|
||||
send() {}
|
||||
sendMessage() {}
|
||||
sendEmbed() {}
|
||||
sendFile() {}
|
||||
sendFiles() {}
|
||||
sendCode() {}
|
||||
fetchMessage() {}
|
||||
fetchMessages() {}
|
||||
fetchPinnedMessages() {}
|
||||
search() {}
|
||||
startTyping() {}
|
||||
stopTyping() {}
|
||||
get typing() {}
|
||||
get typingCount() {}
|
||||
createCollector() {}
|
||||
awaitMessages() {}
|
||||
// Doesn't work on DM channels; bulkDelete() {}
|
||||
acknowledge() {}
|
||||
_cacheMessage() {}
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']);
|
||||
|
||||
@@ -153,25 +153,26 @@ class GroupDMChannel extends Channel {
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
send() { return; }
|
||||
sendMessage() { return; }
|
||||
sendEmbed() { return; }
|
||||
sendFile() { return; }
|
||||
sendFiles() { return; }
|
||||
sendCode() { return; }
|
||||
fetchMessage() { return; }
|
||||
fetchMessages() { return; }
|
||||
fetchPinnedMessages() { return; }
|
||||
search() { return; }
|
||||
startTyping() { return; }
|
||||
stopTyping() { return; }
|
||||
get typing() { return; }
|
||||
get typingCount() { return; }
|
||||
createCollector() { return; }
|
||||
awaitMessages() { return; }
|
||||
// doesn't work on group DMs; bulkDelete() { return; }
|
||||
acknowledge() { return; }
|
||||
_cacheMessage() { return; }
|
||||
/* eslint-disable no-empty-function */
|
||||
send() {}
|
||||
sendMessage() {}
|
||||
sendEmbed() {}
|
||||
sendFile() {}
|
||||
sendFiles() {}
|
||||
sendCode() {}
|
||||
fetchMessage() {}
|
||||
fetchMessages() {}
|
||||
fetchPinnedMessages() {}
|
||||
search() {}
|
||||
startTyping() {}
|
||||
stopTyping() {}
|
||||
get typing() {}
|
||||
get typingCount() {}
|
||||
createCollector() {}
|
||||
awaitMessages() {}
|
||||
// Doesn't work on group DMs; bulkDelete() {}
|
||||
acknowledge() {}
|
||||
_cacheMessage() {}
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(GroupDMChannel, true, ['bulkDelete']);
|
||||
|
||||
@@ -371,7 +371,7 @@ class Guild {
|
||||
fetchMembers(query = '', limit = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.memberCount === this.members.size) {
|
||||
// uncomment in v12
|
||||
// Uncomment in v12
|
||||
// resolve(this.members)
|
||||
resolve(this);
|
||||
return;
|
||||
@@ -388,10 +388,9 @@ class Guild {
|
||||
if (guild.id !== this.id) return;
|
||||
if (this.memberCount === this.members.size || members.length < 1000) {
|
||||
this.client.removeListener(Constants.Events.GUILD_MEMBERS_CHUNK, handler);
|
||||
// uncomment in v12
|
||||
// Uncomment in v12
|
||||
// resolve(this.members)
|
||||
resolve(this);
|
||||
return;
|
||||
}
|
||||
};
|
||||
this.client.on(Constants.Events.GUILD_MEMBERS_CHUNK, handler);
|
||||
|
||||
@@ -501,11 +501,12 @@ class GuildMember {
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
send() { return; }
|
||||
sendMessage() { return; }
|
||||
sendEmbed() { return; }
|
||||
sendFile() { return; }
|
||||
sendCode() { return; }
|
||||
/* eslint-disable no-empty-function */
|
||||
send() {}
|
||||
sendMessage() {}
|
||||
sendEmbed() {}
|
||||
sendFile() {}
|
||||
sendCode() {}
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(GuildMember);
|
||||
|
||||
@@ -119,7 +119,7 @@ class MessageCollector extends EventEmitter {
|
||||
|
||||
const onEnd = (...args) => {
|
||||
cleanup();
|
||||
reject(...args);
|
||||
reject(...args); // eslint-disable-line prefer-promise-reject-errors
|
||||
};
|
||||
|
||||
this.once('message', onMessage);
|
||||
|
||||
@@ -42,7 +42,7 @@ class MessageReaction {
|
||||
*/
|
||||
get emoji() {
|
||||
if (this._emoji instanceof Emoji) return this._emoji;
|
||||
// check to see if the emoji has become known to the client
|
||||
// Check to see if the emoji has become known to the client
|
||||
if (this._emoji.id) {
|
||||
const emojis = this.message.client.emojis;
|
||||
if (emojis.has(this._emoji.id)) {
|
||||
@@ -62,7 +62,7 @@ class MessageReaction {
|
||||
remove(user = this.message.client.user) {
|
||||
const message = this.message;
|
||||
user = this.message.client.resolver.resolveUserID(user);
|
||||
if (!user) return Promise.reject('Couldn\'t resolve the user ID to remove from the reaction.');
|
||||
if (!user) return Promise.reject(new Error('Couldn\'t resolve the user ID to remove from the reaction.'));
|
||||
return message.client.rest.methods.removeMessageReaction(
|
||||
message, this.emoji.identifier, user
|
||||
);
|
||||
|
||||
@@ -90,7 +90,7 @@ class OAuth2Application {
|
||||
this.flags = data.flags;
|
||||
|
||||
/**
|
||||
* oauth2 secret for the app
|
||||
* OAuth2 secret for the application
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.secret = data.secret;
|
||||
|
||||
@@ -73,25 +73,26 @@ class TextChannel extends GuildChannel {
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
send() { return; }
|
||||
sendMessage() { return; }
|
||||
sendEmbed() { return; }
|
||||
sendFile() { return; }
|
||||
sendFiles() { return; }
|
||||
sendCode() { return; }
|
||||
fetchMessage() { return; }
|
||||
fetchMessages() { return; }
|
||||
fetchPinnedMessages() { return; }
|
||||
search() { return; }
|
||||
startTyping() { return; }
|
||||
stopTyping() { return; }
|
||||
get typing() { return; }
|
||||
get typingCount() { return; }
|
||||
createCollector() { return; }
|
||||
awaitMessages() { return; }
|
||||
bulkDelete() { return; }
|
||||
acknowledge() { return; }
|
||||
_cacheMessage() { return; }
|
||||
/* eslint-disable no-empty-function */
|
||||
send() {}
|
||||
sendMessage() {}
|
||||
sendEmbed() {}
|
||||
sendFile() {}
|
||||
sendFiles() {}
|
||||
sendCode() {}
|
||||
fetchMessage() {}
|
||||
fetchMessages() {}
|
||||
fetchPinnedMessages() {}
|
||||
search() {}
|
||||
startTyping() {}
|
||||
stopTyping() {}
|
||||
get typing() {}
|
||||
get typingCount() {}
|
||||
createCollector() {}
|
||||
awaitMessages() {}
|
||||
bulkDelete() {}
|
||||
acknowledge() {}
|
||||
_cacheMessage() {}
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(TextChannel, true);
|
||||
|
||||
@@ -280,11 +280,12 @@ class User {
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
send() { return; }
|
||||
sendMessage() { return; }
|
||||
sendEmbed() { return; }
|
||||
sendFile() { return; }
|
||||
sendCode() { return; }
|
||||
/* eslint-disable no-empty-function */
|
||||
send() {}
|
||||
sendMessage() {}
|
||||
sendEmbed() {}
|
||||
sendFile() {}
|
||||
sendCode() {}
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(User);
|
||||
|
||||
@@ -38,7 +38,7 @@ class UserConnection {
|
||||
this.revoked = data.revoked;
|
||||
|
||||
/**
|
||||
* an array of partial server integrations (not yet implemented in this lib)
|
||||
* Partial server integrations (not yet implemented)
|
||||
* @type {Object[]}
|
||||
*/
|
||||
this.integrations = data.integrations;
|
||||
|
||||
@@ -81,7 +81,6 @@ class TextBasedChannel {
|
||||
|
||||
if (options.embed && options.embed.file) options.file = options.embed.file;
|
||||
|
||||
// backward compat
|
||||
if (options.file) {
|
||||
if (options.files) options.files.push(options.file);
|
||||
else options.files = [options.file];
|
||||
|
||||
Reference in New Issue
Block a user