Skip to content

Commit 43a2317

Browse files
committed
chore(config): Migrate to ESLint v9 and Flat Config
- Migrates the legacy .eslintrc.js to the new eslint.config.js standard (Flat Config). - Remove legacy `.eslintrc.js` and `.eslintignore`. - Add `eslint.config.js` using the Flat Config format.
1 parent ed8601a commit 43a2317

File tree

5 files changed

+135
-67
lines changed

5 files changed

+135
-67
lines changed

.eslintignore

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

.eslintrc.js

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

eslint.config.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import js from '@eslint/js';
2+
import globals from 'globals';
3+
import tseslint from 'typescript-eslint';
4+
import reactPlugin from 'eslint-plugin-react';
5+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
6+
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
7+
import importPlugin from 'eslint-plugin-import';
8+
import prettierPlugin from 'eslint-plugin-prettier';
9+
import prettierConfig from 'eslint-config-prettier';
10+
11+
export default tseslint.config(
12+
{
13+
ignores: ['node_modules/', 'dist/', 'sample/', '.github/'],
14+
},
15+
16+
js.configs.recommended,
17+
...tseslint.configs.recommended,
18+
19+
reactPlugin.configs.flat.recommended,
20+
jsxA11yPlugin.flatConfigs.recommended,
21+
22+
{
23+
plugins: { 'react-hooks': reactHooksPlugin },
24+
rules: reactHooksPlugin.configs.recommended.rules,
25+
},
26+
27+
{
28+
plugins: { prettier: prettierPlugin },
29+
rules: {
30+
'prettier/prettier': 'off',
31+
},
32+
},
33+
34+
{
35+
files: ['**/*.{js,ts,jsx,tsx}'],
36+
languageOptions: {
37+
ecmaVersion: 2022,
38+
sourceType: 'module',
39+
globals: { ...globals.browser, ...globals.es2021, window: 'readonly' },
40+
},
41+
plugins: {
42+
import: importPlugin,
43+
prettier: prettierPlugin,
44+
'@typescript-eslint': tseslint.plugin,
45+
},
46+
settings: {
47+
'import/resolver': {
48+
node: {
49+
paths: ['.', 'src'],
50+
extensions: ['.js', '.ts', '.jsx', '.tsx'],
51+
},
52+
},
53+
react: {
54+
version: 'detect',
55+
},
56+
},
57+
rules: {
58+
'import/extensions': 'off',
59+
'import/prefer-default-export': 'off',
60+
'import/no-webpack-loader-syntax': 'off',
61+
'import/no-unresolved': 'off',
62+
'import/no-extraneous-dependencies': 'off',
63+
'no-use-before-define': 'off',
64+
'no-console': 'off',
65+
'no-extend-native': 'off',
66+
'no-param-reassign': 'off',
67+
'class-methods-use-this': 'off',
68+
'dot-notation': ['error', { allowKeywords: true }],
69+
'func-names': 'off',
70+
'no-underscore-dangle': 'off',
71+
camelcase: 'warn',
72+
'no-plusplus': 'off',
73+
'no-nested-ternary': 'off',
74+
75+
'@typescript-eslint/no-require-imports': 'off',
76+
'@typescript-eslint/no-restricted-types': 'warn',
77+
'@typescript-eslint/no-empty-object-type': 'off',
78+
'@typescript-eslint/no-unused-expressions': 'off',
79+
'no-unused-expressions': 'off',
80+
81+
'@typescript-eslint/no-explicit-any': 'off',
82+
'@typescript-eslint/no-var-requires': 'off',
83+
84+
'prettier/prettier': 'off',
85+
},
86+
},
87+
88+
prettierConfig,
89+
);

package-lock.json

Lines changed: 43 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"@babel/plugin-syntax-dynamic-import": "7.8.3",
7676
"@babel/plugin-transform-regenerator": "7.28.1",
7777
"@babel/preset-env": "7.28.0",
78+
"@eslint/js": "^9.33.0",
7879
"@types/chai": "5.2.2",
7980
"@types/lodash": "4.17.20",
8081
"@types/minimist": "1.2.5",
@@ -99,6 +100,7 @@
99100
"eslint-plugin-prettier": "5.5.4",
100101
"eslint-plugin-react": "7.37.5",
101102
"eslint-plugin-react-hooks": "5.2.0",
103+
"globals": "^16.3.0",
102104
"husky": "9.1.7",
103105
"json-loader": "0.5.7",
104106
"lint-staged": "16.1.5",
@@ -111,6 +113,7 @@
111113
"style-loader": "4.0.0",
112114
"ts-loader": "9.5.2",
113115
"typescript": "5.9.2",
116+
"typescript-eslint": "^8.39.0",
114117
"webpack": "5.101.0",
115118
"webpack-bundle-analyzer": "4.10.2",
116119
"webpack-cli": "6.0.1"

0 commit comments

Comments
 (0)