Skip to content

Commit a8fad29

Browse files
committed
Migrate ESLint from v8 to v9 with flat config
Upgraded ESLint to v9.39.4 and migrated configuration from the legacy .eslintrc.json format to the new flat config format (eslint.config.mjs). Changes: - Updated eslint from ^8.57.1 to ^9.17.0 - Created eslint.config.mjs with flat config format - Removed .eslintrc.json (legacy format) - Removed .eslintignore (now using ignores in config) - Migrated all existing rules and settings to flat config - Used .mjs extension to avoid module type warnings Config migration details: - Converted extends/plugins to ES module imports - Moved ignorePatterns to top-level ignores property - Converted env/globals to languageOptions.globals - Maintained all existing rules and settings - Added prettier config as final config object Result: - All linting passing - All tests passing - Production build working - No ESLint warnings
1 parent 00b3daf commit a8fad29

5 files changed

Lines changed: 299 additions & 286 deletions

File tree

.eslintignore

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

.eslintrc.json

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

eslint.config.mjs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import tseslint from '@typescript-eslint/eslint-plugin';
2+
import tsparser from '@typescript-eslint/parser';
3+
import importPlugin from 'eslint-plugin-import';
4+
import eslintConfigPrettier from 'eslint-config-prettier';
5+
6+
export default [
7+
{
8+
ignores: [
9+
'out/**',
10+
'dist/**',
11+
'**/*.d.ts',
12+
'coverage/**',
13+
'node_modules/**',
14+
],
15+
},
16+
{
17+
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
18+
languageOptions: {
19+
parser: tsparser,
20+
parserOptions: {
21+
project: './tsconfig.eslint.json',
22+
sourceType: 'module',
23+
},
24+
ecmaVersion: 2020,
25+
sourceType: 'module',
26+
globals: {
27+
console: 'readonly',
28+
process: 'readonly',
29+
__dirname: 'readonly',
30+
__filename: 'readonly',
31+
module: 'readonly',
32+
require: 'readonly',
33+
exports: 'readonly',
34+
Buffer: 'readonly',
35+
},
36+
},
37+
plugins: {
38+
'@typescript-eslint': tseslint,
39+
import: importPlugin,
40+
},
41+
rules: {
42+
'@typescript-eslint/adjacent-overload-signatures': 'error',
43+
'@typescript-eslint/no-empty-function': 'error',
44+
'@typescript-eslint/no-empty-interface': 'warn',
45+
'@typescript-eslint/no-namespace': 'error',
46+
'@typescript-eslint/prefer-for-of': 'warn',
47+
'@typescript-eslint/triple-slash-reference': 'error',
48+
'@typescript-eslint/unified-signatures': 'warn',
49+
'no-param-reassign': 'error',
50+
'import/no-unassigned-import': 'warn',
51+
'comma-dangle': ['error', 'only-multiline'],
52+
'constructor-super': 'error',
53+
eqeqeq: ['warn', 'always'],
54+
'no-cond-assign': 'error',
55+
'no-duplicate-case': 'error',
56+
'no-duplicate-imports': 'error',
57+
'no-empty': [
58+
'error',
59+
{
60+
allowEmptyCatch: true,
61+
},
62+
],
63+
'spaced-comment': 'error',
64+
'no-invalid-this': 'error',
65+
'no-new-wrappers': 'error',
66+
'no-redeclare': 'error',
67+
'no-sequences': 'error',
68+
'no-shadow': [
69+
'error',
70+
{
71+
hoist: 'all',
72+
},
73+
],
74+
'no-throw-literal': 'error',
75+
'no-unsafe-finally': 'error',
76+
'no-unused-labels': 'error',
77+
'no-var': 'warn',
78+
'prefer-const': 'warn',
79+
},
80+
},
81+
eslintConfigPrettier,
82+
];

0 commit comments

Comments
 (0)