Skip to content

Commit 2218a64

Browse files
committed
refactor: migrate ESLint to version 9 with a flat configuration
1 parent 58075ff commit 2218a64

File tree

3 files changed

+46
-30
lines changed

3 files changed

+46
-30
lines changed

.eslintrc.js

-24
This file was deleted.

eslint.config.mjs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
2+
import eslintPluginReact from 'eslint-plugin-react'
3+
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
4+
import globals from 'globals'
5+
6+
export default [
7+
{ ignores: ['eslint.config.mjs'] },
8+
{
9+
...eslintPluginReact.configs.flat.recommended,
10+
...eslintPluginReact.configs.flat['jsx-runtime'],
11+
files: ['src/**/*.{js,jsx}'],
12+
plugins: {
13+
eslintPluginReact,
14+
'react-hooks': eslintPluginReactHooks,
15+
},
16+
languageOptions: {
17+
globals: {
18+
...globals.browser,
19+
...globals.node,
20+
},
21+
ecmaVersion: 'latest',
22+
sourceType: 'module',
23+
parserOptions: {
24+
ecmaFeatures: {
25+
jsx: true,
26+
},
27+
},
28+
},
29+
settings: {
30+
react: {
31+
version: 'detect',
32+
},
33+
},
34+
rules: {
35+
...eslintPluginReactHooks.configs.recommended.rules,
36+
},
37+
},
38+
eslintPluginPrettierRecommended,
39+
]

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
1515
"scripts": {
1616
"build": "vite build",
17-
"lint": "eslint \"src/**/*.js\"",
17+
"lint": "eslint",
1818
"serve": "vite preview",
1919
"start": "vite"
2020
},
@@ -41,11 +41,12 @@
4141
"devDependencies": {
4242
"@vitejs/plugin-react": "^4.3.3",
4343
"autoprefixer": "^10.4.20",
44-
"eslint": "^8.57.0",
45-
"eslint-config-prettier": "^9.1.0",
46-
"eslint-plugin-prettier": "^5.2.1",
47-
"eslint-plugin-react": "^7.37.2",
48-
"eslint-plugin-react-hooks": "^4.6.2",
44+
"eslint": "^9.19.0",
45+
"eslint-config-prettier": "^10.0.1",
46+
"eslint-plugin-prettier": "^5.2.3",
47+
"eslint-plugin-react": "^7.37.4",
48+
"eslint-plugin-react-hooks": "^5.1.0",
49+
"globals": "^15.14.0",
4950
"postcss": "^8.4.49",
5051
"prettier": "3.3.3",
5152
"sass": "^1.81.0",

0 commit comments

Comments
 (0)