Skip to content

Commit e8ea3c9

Browse files
authored
chore(lint): migrate to eslint flat config (#2383)
1 parent fb6e4ea commit e8ea3c9

File tree

16 files changed

+1333
-769
lines changed

16 files changed

+1333
-769
lines changed

.eslintrc.js

-32
This file was deleted.

eslint.config.mjs

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from 'typescript-eslint';
3+
import reactPlugin from 'eslint-plugin-react';
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import globals from "globals";
6+
import eslintConfigPrettier from "eslint-config-prettier";
7+
8+
export default tseslint.config(
9+
eslint.configs.recommended,
10+
tseslint.configs.recommended,
11+
// tseslint.configs.recommendedTypeChecked, // Add type checks.
12+
{
13+
languageOptions: {
14+
globals: {
15+
...globals.serviceworker,
16+
...globals.browser,
17+
},
18+
parserOptions: {
19+
projectService: true,
20+
tsconfigRootDir: import.meta.dirname,
21+
},
22+
},
23+
},
24+
{
25+
files: ['**/*.js'],
26+
extends: [tseslint.configs.disableTypeChecked],
27+
},
28+
{
29+
rules: {
30+
'@typescript-eslint/ban-ts-comment': 'off',
31+
'@typescript-eslint/explicit-function-return-type': 'off',
32+
'@typescript-eslint/no-explicit-any': 'off',
33+
'@typescript-eslint/no-unused-vars': 'off',
34+
'@typescript-eslint/no-unused-expressions': 'off',
35+
'no-case-declarations': 'off',
36+
'no-prototype-builtins': 'off',
37+
},
38+
},
39+
reactPlugin.configs.flat.recommended,
40+
reactPlugin.configs.flat['jsx-runtime'],
41+
{
42+
settings: {
43+
react: {
44+
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
45+
},
46+
},
47+
rules: {
48+
'react/no-deprecated': 'warn',
49+
'react/prop-types': 'off',
50+
},
51+
},
52+
{
53+
files: ['**/*.{jsx,tsx}'],
54+
plugins: {
55+
"react-refresh": reactRefresh,
56+
},
57+
rules: {
58+
'react-refresh/only-export-components': 'warn',
59+
},
60+
},
61+
eslintConfigPrettier, // Avoid conflict with prettier.
62+
);

package.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
"dist/*"
3232
],
3333
"engines": {
34-
"node": ">=18"
34+
"node": ">=20.11"
3535
},
3636
"devDependencies": {
3737
"@codemirror/lang-javascript": "^6.2.2",
3838
"@commitlint/cli": "~17.8.0",
3939
"@commitlint/config-conventional": "~17.8.0",
4040
"@ebay/nice-modal-react": "~1.2.13",
41+
"@eslint/js": "^9.18.0",
4142
"@fortawesome/fontawesome-free": "~6.6.0",
4243
"@rjsf/bootstrap-5": "https://github.com/nurikk/fileshare/blob/main/rjsf-bootstrap-5-4.2.0.tgz?raw=true",
4344
"@rjsf/core": "~4.2.3",
@@ -60,8 +61,6 @@
6061
"@types/react-transition-group": "~4.4.7",
6162
"@types/reconnectingwebsocket": "~1.0.8",
6263
"@types/ws": "~8.5.6",
63-
"@typescript-eslint/eslint-plugin": "~6.7.4",
64-
"@typescript-eslint/parser": "~6.7.4",
6564
"@uiw/codemirror-theme-github": "^4.21.24",
6665
"@uiw/react-codemirror": "^4.21.24",
6766
"@vitejs/plugin-react": "~4.3.0",
@@ -77,14 +76,13 @@
7776
"d3-zoom": "~3.0.0",
7877
"deep-diff": "~1.0.2",
7978
"deep-object-diff": "~1.1.9",
80-
"eslint": "~8.57.0",
81-
"eslint-config-prettier": "~9.1.0",
82-
"eslint-config-react": "~1.1.7",
83-
"eslint-plugin-prettier": "~5.0.0",
84-
"eslint-plugin-react": "~7.33.2",
85-
"eslint-plugin-react-refresh": "*",
79+
"eslint": "~9.18.0",
80+
"eslint-config-prettier": "~10.0.1",
81+
"eslint-plugin-react": "~7.37.4",
82+
"eslint-plugin-react-refresh": "~0.4.18",
8683
"events": "~3.3.0",
8784
"file-saver": "~2.0.5",
85+
"globals": "~15.14.0",
8886
"husky": "~8.0.3",
8987
"i18next": "~23.5.1",
9088
"i18next-browser-languagedetector": "~7.1.0",
@@ -93,7 +91,7 @@
9391
"lodash": "~4.17.21",
9492
"notyf": "~3.10.0",
9593
"pinst": "~3.0.0",
96-
"prettier": "~3.0.3",
94+
"prettier": "~3.4.2",
9795
"react": "~18.2.0",
9896
"react-app-polyfill": "~3.0.0",
9997
"react-bootstrap": "~2.10.0",
@@ -110,6 +108,7 @@
110108
"store2": "^2.14.2",
111109
"timeago.js": "~4.0.2",
112110
"typescript": "~5.2.2",
111+
"typescript-eslint": "^8.21.0",
113112
"unistore": "~3.5.2",
114113
"vite": "~4.5.0",
115114
"vite-plugin-compression": "~0.5.1",

0 commit comments

Comments
 (0)