Add new ESLint rules

This commit is contained in:
Schuyler Cebulskie
2017-03-17 01:23:39 -04:00
parent 2237749d29
commit 136cab240d
26 changed files with 117 additions and 110 deletions

View File

@@ -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']);

View File

@@ -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']);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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
);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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];