Skip to content

Commit

Permalink
style: bump eslint to 9
Browse files Browse the repository at this point in the history
  • Loading branch information
SocketSomeone committed Jan 21, 2025
1 parent 89208c8 commit 875e41d
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 226 deletions.
29 changes: 0 additions & 29 deletions .eslintrc

This file was deleted.

54 changes: 54 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import eslint from '@eslint/js';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
ignores: ['node_modules', '**/node_modules/**', '**/*.js', '**/*.d.ts']
},
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
eslintPluginPrettierRecommended,
{
languageOptions: {
globals: {
...globals.node,
...globals.jest
},
ecmaVersion: 5,
sourceType: 'module',
parserOptions: {
project: ['tsconfig.json', 'tsconfig.build.json', 'tsconfig.spec.json'],
projectService: true,
tsconfigRootDir: import.meta.dirname
}
}
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: false,
checksConditionals: false
}
],
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'@typescript-eslint/no-base-to-string': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/only-throw-error': 'off'
}
}
);
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"publish:dev": "npm publish --access public --tag dev",
"prepare": "husky",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "eslint --ignore-path .gitignore src/**/*.ts",
"lint": "eslint --ignore-pattern .gitignore src/**/*.ts",
"changelog": "git cliff --prepend ./CHANGELOG.md -l --current -c ./cliff.toml -r ."
},
"lint-staged": {
Expand Down Expand Up @@ -57,17 +57,20 @@
"devDependencies": {
"@commitlint/cli": "19.6.1",
"@commitlint/config-angular": "19.7.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.18.0",
"@favware/npm-deprecate": "2.0.0",
"@nestjs/common": "11.0.3",
"@nestjs/core": "11.0.3",
"@types/node": "22.10.7",
"@typescript-eslint/eslint-plugin": "7.0.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"@typescript-eslint/parser": "^8.21.0",
"discord-api-types": "0.37.117",
"discord.js": "14.17.3",
"eslint": "8.57.1",
"eslint-config-prettier": "10.0.1",
"eslint-plugin-prettier": "5.2.3",
"globals": "^15.14.0",
"husky": "9.1.7",
"lint-staged": "15.4.1",
"prettier": "3.4.2",
Expand All @@ -76,13 +79,14 @@
"rimraf": "6.0.1",
"rxjs": "7.8.1",
"ts-node": "10.9.2",
"typescript": "5.7.3"
"typescript": "5.7.3",
"typescript-eslint": "^8.21.0"
},
"peerDependencies": {
"@nestjs/common": "^10.2.0 || ^11.0.0",
"@nestjs/core": "^10.2.0 || ^11.0.0",
"discord.js": "^14.0.1",
"discord-api-types": "^0.37.99",
"discord.js": "^14.0.1",
"reflect-metadata": "^0.2.1",
"rxjs": "^7.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/commands/slash-commands/slash-command.discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { APIApplicationCommandOptionBase } from 'discord-api-types/payloads/v10/
import { CommandDiscovery } from '../command.discovery';
import { OPTIONS_METADATA } from './options';

// @ts-ignore
// @ts-expect-error - This is a decorator.
export interface SlashCommandMeta extends ChatInputApplicationCommandData {
type?:
| ApplicationCommandType.ChatInput
Expand Down
33 changes: 12 additions & 21 deletions src/message-components/decorators/selected.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import {
ChannelSelectMenuInteraction,
Collection,
MentionableSelectMenuInteraction,
RoleSelectMenuInteraction,
UserSelectMenuInteraction
} from 'discord.js';
import { NecordExecutionContext } from '../../context';

export const SelectedStrings = createParamDecorator<any, any, string[]>(
(_, ctx: ExecutionContext) => {
const necordContext = NecordExecutionContext.create(ctx);
const [interaction] = necordContext.getContext<'interactionCreate'>();
export const SelectedStrings = createParamDecorator<any, string[]>((_, ctx: ExecutionContext) => {
const necordContext = NecordExecutionContext.create(ctx);
const [interaction] = necordContext.getContext<'interactionCreate'>();

return interaction.isStringSelectMenu() ? interaction.values : [];
}
);
return interaction.isStringSelectMenu() ? interaction.values : [];
});

export type ISelectedChannels = ChannelSelectMenuInteraction['channels'];
export const SelectedChannels = createParamDecorator<any, any, ISelectedChannels>(
export const SelectedChannels = createParamDecorator<any, ISelectedChannels>(
(_, ctx: ExecutionContext) => {
const necordContext = NecordExecutionContext.create(ctx);
const [interaction] = necordContext.getContext<'interactionCreate'>();
Expand All @@ -27,10 +24,8 @@ export const SelectedChannels = createParamDecorator<any, any, ISelectedChannels
}
);

export type ISelectedUsers =
| UserSelectMenuInteraction['users']
| MentionableSelectMenuInteraction['users'];
export const SelectedUsers = createParamDecorator<any, any, ISelectedUsers>(
export type ISelectedUsers = UserSelectMenuInteraction['users'];
export const SelectedUsers = createParamDecorator<any, ISelectedUsers>(
(_, ctx: ExecutionContext) => {
const necordContext = NecordExecutionContext.create(ctx);
const [interaction] = necordContext.getContext<'interactionCreate'>();
Expand All @@ -43,10 +38,8 @@ export const SelectedUsers = createParamDecorator<any, any, ISelectedUsers>(
}
);

export type ISelectedMembers =
| UserSelectMenuInteraction['members']
| MentionableSelectMenuInteraction['members'];
export const SelectedMembers = createParamDecorator<any, any, ISelectedMembers>(
export type ISelectedMembers = UserSelectMenuInteraction['members'];
export const SelectedMembers = createParamDecorator<any, ISelectedMembers>(
(_, ctx: ExecutionContext) => {
const necordContext = NecordExecutionContext.create(ctx);
const [interaction] = necordContext.getContext<'interactionCreate'>();
Expand All @@ -58,10 +51,8 @@ export const SelectedMembers = createParamDecorator<any, any, ISelectedMembers>(
}
);

export type ISelectedRoles =
| RoleSelectMenuInteraction['roles']
| MentionableSelectMenuInteraction['roles'];
export const SelectedRoles = createParamDecorator<any, any, ISelectedRoles>(
export type ISelectedRoles = RoleSelectMenuInteraction['roles'];
export const SelectedRoles = createParamDecorator<any, ISelectedRoles>(
(_, ctx: ExecutionContext) => {
const necordContext = NecordExecutionContext.create(ctx);
const [interaction] = necordContext.getContext<'interactionCreate'>();
Expand Down
2 changes: 1 addition & 1 deletion src/text-commands/text-commands.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class TextCommandsModule implements OnModuleInit, OnApplicationBootstrap
const content = message.content.toLowerCase();
const prefix =
typeof this.options.prefix !== 'function'
? this.options.prefix ?? '!'
? (this.options.prefix ?? '!')
: await this.options.prefix(message);

if (!prefix || !content.startsWith(prefix)) return;
Expand Down
Loading

0 comments on commit 875e41d

Please sign in to comment.