Update eslintrc.json to also make it consider typings

note that I've marked Promises awaiting as a warn,
because I don't want to be bothered with it for now.

I also edited all files to accomodate with the new rules.

I should also think find a way to type-safely import Commands directory,
another time
This commit is contained in:
Wroclaw 2023-07-30 22:28:13 +02:00
parent c4676175ff
commit 7225739527
9 changed files with 35 additions and 23 deletions

View file

@ -12,6 +12,7 @@ export default class CommandManager {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
this.commands.push(new (files[i].default as Command)());
}
catch (e) {
@ -27,13 +28,13 @@ export default class CommandManager {
interaction.isMessageContextMenuCommand() ||
interaction.isUserContextMenuCommand()
) {
const foundCommand = this.commands.find((command) => command.name == interaction.commandName );
const foundCommand = this.commands.find((command) => command.name === interaction.commandName );
if (!foundCommand) throw new Error(`Unknown command received (${interaction.commandName}). Did you forgot to push updated commands?`);
foundCommand.execute(interaction);
return;
}
if (interaction.isAutocomplete()) {
const foundCommand = this.commands.find((command) => command.name == interaction.commandName );
const foundCommand = this.commands.find((command) => command.name === interaction.commandName );
if (!foundCommand) throw new Error(`Unknown command received (${interaction.commandName}). Did you forgot to push updated commands?`);
if (!foundCommand.autocomplete) return;
foundCommand.autocomplete(interaction);