Skip to content

Commit f10b0ff

Browse files
committed
chore: update eslint to v9
1 parent 860851c commit f10b0ff

File tree

6 files changed

+1356
-466
lines changed

6 files changed

+1356
-466
lines changed

.eslintrc.js

Lines changed: 0 additions & 152 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
import importPlugin from 'eslint-plugin-import';
2+
import tsStylistic from '@stylistic/eslint-plugin-ts';
3+
import eslint from '@eslint/js';
4+
import globals from 'globals';
5+
import tsEslint from 'typescript-eslint';
6+
7+
export default tsEslint.config(
8+
{
9+
ignores: ['**/node_modules', '**/dist', '**/coverage', '**/*.{js,mjs}', '**/*.d.ts'],
10+
},
11+
eslint.configs.recommended,
12+
tsEslint.configs.recommended,
13+
{
14+
plugins: {
15+
'@typescript-eslint': tsEslint.plugin,
16+
import: importPlugin,
17+
'@stylistic': tsStylistic,
18+
},
19+
languageOptions: {
20+
globals: {
21+
...globals.browser,
22+
...globals.node,
23+
},
24+
parser: tsEslint.parser,
25+
ecmaVersion: 2023,
26+
sourceType: 'module',
27+
parserOptions: {
28+
project: 'tsconfig.json',
29+
},
30+
},
31+
rules: {
32+
'@typescript-eslint/consistent-type-imports': 'error',
33+
'@typescript-eslint/prefer-optional-chain': 'error',
34+
'@typescript-eslint/no-explicit-any': 'off',
35+
'@typescript-eslint/no-floating-promises': ['error', { checkThenables: false }],
36+
'@typescript-eslint/ban-types': 'off',
37+
'@typescript-eslint/explicit-function-return-type': 'off',
38+
'@typescript-eslint/no-non-null-assertion': 'off',
39+
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
40+
'@typescript-eslint/ban-ts-comment': 'off',
41+
'@typescript-eslint/no-unused-vars': 'off',
42+
'@typescript-eslint/naming-convention': ['error', {
43+
selector: 'default', format: null,
44+
}, {
45+
selector: 'variable', format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
46+
}, {
47+
selector: 'typeLike', format: ['PascalCase'],
48+
}],
49+
'@typescript-eslint/explicit-module-boundary-types': 'off',
50+
'@typescript-eslint/no-empty-interface': 'off',
51+
'@typescript-eslint/adjacent-overload-signatures': 'error',
52+
'@typescript-eslint/consistent-type-assertions': 'error',
53+
'@typescript-eslint/no-array-constructor': 'error',
54+
'@typescript-eslint/no-empty-function': 'error',
55+
'@typescript-eslint/no-inferrable-types': 'error',
56+
'@typescript-eslint/no-misused-new': 'error',
57+
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
58+
'@typescript-eslint/no-this-alias': 'error',
59+
'@typescript-eslint/no-use-before-define': 'error',
60+
'@typescript-eslint/no-var-requires': 'error',
61+
'@typescript-eslint/triple-slash-reference': 'error',
62+
'@stylistic/type-annotation-spacing': 'error',
63+
'@typescript-eslint/array-type': 'error',
64+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
65+
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
66+
'@typescript-eslint/no-require-imports': 'off',
67+
'@typescript-eslint/no-empty-object-type': 'off',
68+
'@typescript-eslint/no-unsafe-function-type': 'off',
69+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
70+
'@stylistic/semi': ['error', 'always'],
71+
'@typescript-eslint/no-useless-constructor': 'error',
72+
'@typescript-eslint/no-redeclare': ['error'],
73+
'@stylistic/member-delimiter-style': ['error', {
74+
multiline: { delimiter: 'semi', requireLast: true },
75+
singleline: { delimiter: 'semi', requireLast: false },
76+
}],
77+
'@stylistic/space-before-function-paren': ['error', {
78+
anonymous: 'always',
79+
named: 'never',
80+
asyncArrow: 'always',
81+
}],
82+
'@stylistic/space-infix-ops': 'error',
83+
'@stylistic/comma-spacing': 'error',
84+
'arrow-parens': ['error', 'as-needed'],
85+
'arrow-spacing': 'error',
86+
'space-infix-ops': 'off',
87+
'no-var': 'error',
88+
'prefer-const': 'error',
89+
'prefer-rest-params': 'error',
90+
'prefer-spread': 'error',
91+
'constructor-super': 'error',
92+
'for-direction': 'error',
93+
'getter-return': 'error',
94+
'import/no-duplicates': ['error', { 'prefer-inline': true }],
95+
'no-async-promise-executor': 'error',
96+
'no-case-declarations': 'error',
97+
'no-class-assign': 'error',
98+
'no-compare-neg-zero': 'error',
99+
'no-cond-assign': 'error',
100+
'no-const-assign': 'error',
101+
'no-constant-condition': 'error',
102+
'no-control-regex': 'error',
103+
'no-debugger': 'error',
104+
'no-delete-var': 'error',
105+
'no-dupe-args': 'error',
106+
'no-dupe-keys': 'error',
107+
'no-duplicate-case': 'error',
108+
'no-empty': 'error',
109+
'no-empty-character-class': 'error',
110+
'no-empty-pattern': 'error',
111+
'no-ex-assign': 'error',
112+
'no-extra-boolean-cast': 'error',
113+
'no-extra-semi': 'error',
114+
'no-fallthrough': 'error',
115+
'no-func-assign': 'error',
116+
'no-global-assign': 'error',
117+
'no-inner-declarations': 'error',
118+
'no-invalid-regexp': 'error',
119+
'no-irregular-whitespace': 'error',
120+
'no-misleading-character-class': 'error',
121+
'no-mixed-spaces-and-tabs': 'error',
122+
'no-new-symbol': 'error',
123+
'no-obj-calls': 'error',
124+
'no-octal': 'error',
125+
'no-prototype-builtins': 'error',
126+
'no-redeclare': 'off',
127+
'no-regex-spaces': 'error',
128+
'no-self-assign': 'error',
129+
'no-shadow-restricted-names': 'error',
130+
'no-sparse-arrays': 'error',
131+
'no-this-before-super': 'error',
132+
'no-undef': 'error',
133+
'no-unexpected-multiline': 'error',
134+
'no-unreachable': 'error',
135+
'no-unsafe-finally': 'error',
136+
'no-unsafe-negation': 'error',
137+
'no-unused-labels': 'error',
138+
'no-useless-catch': 'error',
139+
'no-useless-escape': 'error',
140+
'no-with': 'error',
141+
'require-yield': 'error',
142+
'use-isnan': 'error',
143+
'valid-typeof': 'error',
144+
'comma-dangle': ['error', 'always-multiline'],
145+
'dot-notation': 'error',
146+
'eol-last': 'error',
147+
eqeqeq: ['error', 'always', { null: 'ignore' }],
148+
'no-console': 'error',
149+
'no-duplicate-imports': 'off',
150+
'no-multiple-empty-lines': 'error',
151+
'no-throw-literal': 'error',
152+
'no-trailing-spaces': 'error',
153+
'no-undef-init': 'error',
154+
'object-shorthand': 'error',
155+
'quote-props': ['error', 'consistent-as-needed'],
156+
'spaced-comment': 'error',
157+
yoda: 'error',
158+
curly: 'error',
159+
'object-curly-spacing': ['error', 'always'],
160+
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
161+
'padded-blocks': ['error', { classes: 'always' }],
162+
'no-else-return': 'error',
163+
'block-spacing': ['error', 'always'],
164+
'space-before-blocks': ['error', 'always'],
165+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
166+
'keyword-spacing': ['error', { before: true, after: true }],
167+
'space-in-parens': ['error', 'never'],
168+
},
169+
},
170+
{
171+
files: ['tests/**/*'],
172+
languageOptions: {
173+
globals: {
174+
...globals.jest,
175+
},
176+
parserOptions: {
177+
project: 'tests/tsconfig.json',
178+
},
179+
},
180+
rules: {
181+
'@typescript-eslint/no-inferrable-types': 'off',
182+
'@typescript-eslint/no-use-before-define': 'off',
183+
'@typescript-eslint/no-var-requires': 'off',
184+
'@typescript-eslint/consistent-type-imports': 'off',
185+
'no-console': ['error', { allow: ['time', 'timeEnd'] }],
186+
'no-control-regex': 'off',
187+
'no-empty': 'off',
188+
'import/no-duplicates': 'off',
189+
},
190+
},
191+
);

jest.config.ts renamed to jest.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import type { Config } from '@jest/types';
2-
3-
// Sync object
4-
const config: Config.InitialOptions = {
1+
export default {
52
testTimeout: 30000,
63
transform: {
74
'^.+\\.tsx?$': ['ts-jest', {
@@ -18,5 +15,3 @@ const config: Config.InitialOptions = {
1815
'<rootDir>/package.json',
1916
],
2017
};
21-
22-
export default config;

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,21 @@
5151
"@nestjs/core": "^11.0.5",
5252
"@nestjs/platform-express": "^11.0.5",
5353
"@nestjs/testing": "^11.0.5",
54+
"@stylistic/eslint-plugin-ts": "^3.0.1",
5455
"@types/jest": "^29.5.12",
5556
"@types/node": "^22.0.0",
5657
"@types/supertest": "^6.0.2",
57-
"@typescript-eslint/eslint-plugin": "~7.18.0",
58-
"@typescript-eslint/parser": "~7.18.0",
5958
"conventional-changelog": "^6.0.0",
6059
"conventional-changelog-cli": "^5.0.0",
61-
"eslint": "^8.57.0",
62-
"eslint-plugin-import": "^2.29.1",
60+
"eslint": "^9.19.0",
61+
"eslint-plugin-import": "^2.31.0",
6362
"jest": "^29.7.0",
6463
"rxjs": "^7.8.1",
6564
"supertest": "^7.0.0",
6665
"ts-jest": "^29.1.2",
6766
"ts-node": "^10.9.2",
68-
"typescript": "5.7.3"
67+
"typescript": "5.7.3",
68+
"typescript-eslint": "^8.22.0"
6969
},
7070
"commitlint": {
7171
"extends": [

0 commit comments

Comments
 (0)