From ec6b3e4ed2a5b02b367711b531f06087e894c834 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 6 Apr 2024 18:16:23 -0400 Subject: [PATCH] Fix all eslint v9 issues --- commands/edit-meme/alert.js | 1 - commands/edit-meme/chi-idea.js | 1 - commands/edit-meme/raw.js | 1 - commands/games-mp/chess.js | 2 +- commands/games-mp/nim.js | 2 +- commands/games-sp/hangman.js | 4 +-- commands/games-sp/horse-race.js | 1 - commands/games-sp/whos-that-pokemon-cry.js | 1 - commands/games-sp/whos-that-pokemon.js | 1 - commands/random-seed/name-rater.js | 2 +- commands/util/eval.js | 4 +-- framework/types/member.js | 2 +- framework/types/user.js | 2 +- structures/cards-against-humanity/Player.js | 2 +- structures/mafia/Game.js | 2 +- types/code.js | 33 --------------------- 16 files changed, 11 insertions(+), 50 deletions(-) delete mode 100644 types/code.js diff --git a/commands/edit-meme/alert.js b/commands/edit-meme/alert.js index 9042e20a..fae4c11f 100644 --- a/commands/edit-meme/alert.js +++ b/commands/edit-meme/alert.js @@ -27,7 +27,6 @@ module.exports = class AlertCommand extends Command { name: 'The Hill', url: 'https://thehill.com/', reason: 'Image', - // eslint-disable-next-line max-len reasonURL: 'https://thehill.com/policy/technology/409737-this-is-a-test-us-officials-test-presidential-alert' } ], diff --git a/commands/edit-meme/chi-idea.js b/commands/edit-meme/chi-idea.js index f5a9b65c..a21983e9 100644 --- a/commands/edit-meme/chi-idea.js +++ b/commands/edit-meme/chi-idea.js @@ -32,7 +32,6 @@ module.exports = class ChiIdeaCommand extends Command { name: 'Inside Scanlation', url: 'https://www.insidescanlation.com/', reason: 'Wild Words Font', - // eslint-disable-next-line max-len reasonURL: 'https://www.insidescanlation.com/etc/the-idiots-guide-to-editing-manga/guide/type/fonts.html' } ], diff --git a/commands/edit-meme/raw.js b/commands/edit-meme/raw.js index d05013e1..3c642539 100644 --- a/commands/edit-meme/raw.js +++ b/commands/edit-meme/raw.js @@ -21,7 +21,6 @@ module.exports = class RawCommand extends Command { name: 'Inside Scanlation', url: 'https://www.insidescanlation.com/', reason: 'Wild Words Font', - // eslint-disable-next-line max-len reasonURL: 'https://www.insidescanlation.com/etc/the-idiots-guide-to-editing-manga/guide/type/fonts.html' } ], diff --git a/commands/games-mp/chess.js b/commands/games-mp/chess.js index 76b9ca4b..0264006e 100644 --- a/commands/games-mp/chess.js +++ b/commands/games-mp/chess.js @@ -158,7 +158,7 @@ module.exports = class ChessCommand extends Command { if (alreadySaved) { await msg.say('You already have a saved game, do you want to overwrite it?'); const verification = await verify(msg.channel, author); - if (!verification) continue; // eslint-disable-line max-depth + if (!verification) continue; } if (gameState.turn === 'black') blackTime -= new Date() - now; if (gameState.turn === 'white') whiteTime -= new Date() - now; diff --git a/commands/games-mp/nim.js b/commands/games-mp/nim.js index 404441f1..29fda890 100644 --- a/commands/games-mp/nim.js +++ b/commands/games-mp/nim.js @@ -109,7 +109,7 @@ module.exports = class NimCommand extends Command { time: 60000 }); if (!rowTurn.size) { - if (lastTurnTimeout) { // eslint-disable-line max-depth + if (lastTurnTimeout) { winner = 'time'; break; } else { diff --git a/commands/games-sp/hangman.js b/commands/games-sp/hangman.js index 5fd7e339..1e3a3efa 100644 --- a/commands/games-sp/hangman.js +++ b/commands/games-sp/hangman.js @@ -72,7 +72,7 @@ module.exports = class HangmanCommand extends Command { } else if (word.includes(choice)) { displayText = true; for (let i = 0; i < word.length; i++) { - if (word.charAt(i) !== choice) continue; // eslint-disable-line max-depth + if (word.charAt(i) !== choice) continue; confirmation.push(word.charAt(i)); display[i] = word.charAt(i); } @@ -112,7 +112,7 @@ module.exports = class HangmanCommand extends Command { partOfSpeech: data.fl, definiton: data.shortdef.map((definition, i) => `(${i + 1}) ${definition}`).join('\n') }; - } catch (err) { + } catch { return null; } } diff --git a/commands/games-sp/horse-race.js b/commands/games-sp/horse-race.js index cdd79032..aa25c95e 100644 --- a/commands/games-sp/horse-race.js +++ b/commands/games-sp/horse-race.js @@ -26,7 +26,6 @@ module.exports = class HorseRaceCommand extends Command { name: 'Ambition', url: 'https://ambition.com/', reason: 'Image', - // eslint-disable-next-line max-len reasonURL: 'https://help.ambition.com/hc/en-us/articles/360005048011-How-do-I-set-up-a-Leaderboard-Slide-' }, { diff --git a/commands/games-sp/whos-that-pokemon-cry.js b/commands/games-sp/whos-that-pokemon-cry.js index 24ccf2f2..5ebd55c2 100644 --- a/commands/games-sp/whos-that-pokemon-cry.js +++ b/commands/games-sp/whos-that-pokemon-cry.js @@ -37,7 +37,6 @@ module.exports = class WhosThatPokemonCryCommand extends Command { name: 'u/CaptainRako', url: 'https://www.reddit.com/user/CaptainRako/', reason: 'Background Image', - // eslint-disable-next-line max-len reasonURL: 'https://www.reddit.com/r/pokemon/comments/420xiv/whos_that_pokemon_1920x1080_hd_template_i_just/' }, { diff --git a/commands/games-sp/whos-that-pokemon.js b/commands/games-sp/whos-that-pokemon.js index cd581931..97dfe967 100644 --- a/commands/games-sp/whos-that-pokemon.js +++ b/commands/games-sp/whos-that-pokemon.js @@ -44,7 +44,6 @@ module.exports = class WhosThatPokemonCommand extends Command { name: 'u/CaptainRako', url: 'https://www.reddit.com/user/CaptainRako/', reason: 'Background Image', - // eslint-disable-next-line max-len reasonURL: 'https://www.reddit.com/r/pokemon/comments/420xiv/whos_that_pokemon_1920x1080_hd_template_i_just/' }, { diff --git a/commands/random-seed/name-rater.js b/commands/random-seed/name-rater.js index 1f3d09c8..9d531412 100644 --- a/commands/random-seed/name-rater.js +++ b/commands/random-seed/name-rater.js @@ -32,7 +32,7 @@ module.exports = class NameRaterCommand extends Command { const user = await this.client.users.fetch(matches[1]); if (!user) return false; return true; - } catch (err) { + } catch { return false; } } diff --git a/commands/util/eval.js b/commands/util/eval.js index a906f1d5..f249e8f2 100644 --- a/commands/util/eval.js +++ b/commands/util/eval.js @@ -1,9 +1,9 @@ // Credit: https://github.com/discordjs/Commando/blob/master/src/commands/util/eval.js const util = require('util'); -/* eslint-disable no-unused-vars, prefer-destructuring */ +/* eslint-disable no-unused-vars */ const discord = require('discord.js'); const Util = require('../../util/Util'); -/* eslint-enable no-unused-vars, prefer-destructuring */ +/* eslint-enable no-unused-vars */ const tags = require('common-tags'); const Command = require('../../framework/Command'); diff --git a/framework/types/member.js b/framework/types/member.js index 259a4e28..5077b17b 100644 --- a/framework/types/member.js +++ b/framework/types/member.js @@ -12,7 +12,7 @@ module.exports = class MemberArgumentType extends ArgumentType { const member = await msg.guild.members.fetch(await this.client.users.fetch(matches[1])); if (!member) return false; return true; - } catch (err) { + } catch { return false; } } diff --git a/framework/types/user.js b/framework/types/user.js index 87e98866..c507a036 100644 --- a/framework/types/user.js +++ b/framework/types/user.js @@ -12,7 +12,7 @@ module.exports = class UserArgumentType extends ArgumentType { const user = await msg.client.users.fetch(matches[1]); if (!user) return false; return true; - } catch (err) { + } catch { return false; } } diff --git a/structures/cards-against-humanity/Player.js b/structures/cards-against-humanity/Player.js index 21c0ac62..df3220cc 100644 --- a/structures/cards-against-humanity/Player.js +++ b/structures/cards-against-humanity/Player.js @@ -31,7 +31,7 @@ module.exports = class Player { const extra = await this.chooseCards(black, chosenCards); if (!this.user.bot) await this.user.send(`Nice! Return to ${this.game.channel} to await the results!`); return extra; - } catch (err) { + } catch { this.strikes++; return 0; } diff --git a/structures/mafia/Game.js b/structures/mafia/Game.js index 376e8051..dbce64e9 100644 --- a/structures/mafia/Game.js +++ b/structures/mafia/Game.js @@ -29,7 +29,7 @@ module.exports = class Game { for (const user of list) { try { await user.send(`You are ${roles[i] === 'detective' ? 'the' : 'a part of the'} **${roles[i]}**.`); - } catch (err) { + } catch { await this.channel.send( `${user}, I couldn't send a DM to you. Please open your DMs and use the \`me\` command to see your role.` ); diff --git a/types/code.js b/types/code.js deleted file mode 100644 index 6fd68341..00000000 --- a/types/code.js +++ /dev/null @@ -1,33 +0,0 @@ -const Argument = require('../framework/ArgumentType'); -const codeblock = /```(?:(\S+)\n)?\s*([^]+?)\s*```/i; - -module.exports = class CodeArgument extends Argument { - constructor(client) { - super(client, 'code'); - } - - validate(value) { - if (!value) return false; - return true; - } - - async parse(value, msg) { - if (!value) return null; - if (/^[0-9]+$/.test(value)) { - try { - const message = await msg.channel.messages.fetch(value); - value = message.content; - } catch (err) { - return { code: value, lang: null }; - } - } - if (codeblock.test(value)) { - const parsed = codeblock.exec(value); - return { - code: parsed[2], - lang: parsed[1] ? parsed[1].toLowerCase() : null - }; - } - return { code: value, lang: null }; - } -};