Skip to content

Commit b770042

Browse files
committed
refactor: migrate eslint
1 parent d649d32 commit b770042

18 files changed

+809
-885
lines changed

web/.eslintrc.json

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

web/eslint.config.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import eslint from "@eslint/js";
2+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
3+
import tseslint from "typescript-eslint";
4+
5+
export default [
6+
...tseslint.config(eslint.configs.recommended, tseslint.configs.recommended),
7+
eslintPluginPrettierRecommended,
8+
{
9+
ignores: ["**/dist/**", "**/node_modules/**", "**/proto/**"],
10+
},
11+
{
12+
rules: {
13+
"no-unused-vars": "off",
14+
"@typescript-eslint/no-unused-vars": "error",
15+
"@typescript-eslint/no-explicit-any": ["off"],
16+
"react/react-in-jsx-scope": "off",
17+
"react/jsx-no-target-blank": "off",
18+
"no-restricted-syntax": [
19+
"error",
20+
{
21+
selector:
22+
"VariableDeclarator[init.callee.name='useTranslation'] > ObjectPattern > Property[key.name='t']:not([parent.declarations.0.init.callee.object.name='i18n'])",
23+
message: "Destructuring 't' from useTranslation is not allowed. Please use the 'useTranslate' hook from '@/utils/i18n'.",
24+
},
25+
],
26+
},
27+
},
28+
{
29+
files: ["src/utils/i18n.ts"],
30+
rules: {
31+
"no-restricted-syntax": "off",
32+
},
33+
},
34+
];

web/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"devDependencies": {
5353
"@bufbuild/buf": "^1.50.1",
5454
"@bufbuild/protobuf": "^2.2.3",
55+
"@eslint/js": "^9.23.0",
5556
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
5657
"@types/d3": "^7.4.3",
5758
"@types/katex": "^0.16.7",
@@ -63,15 +64,13 @@
6364
"@types/react-dom": "^18.3.5",
6465
"@types/textarea-caret": "^3.0.3",
6566
"@types/uuid": "^10.0.0",
66-
"@typescript-eslint/eslint-plugin": "^7.18.0",
67-
"@typescript-eslint/parser": "^7.18.0",
6867
"@vitejs/plugin-legacy": "^6.0.2",
6968
"@vitejs/plugin-react": "^4.3.4",
7069
"autoprefixer": "^10.4.21",
7170
"code-inspector-plugin": "^0.18.3",
72-
"eslint": "^8.57.1",
73-
"eslint-config-prettier": "^9.1.0",
74-
"eslint-plugin-prettier": "^5.2.3",
71+
"eslint": "^9.23.0",
72+
"eslint-config-prettier": "^10.1.1",
73+
"eslint-plugin-prettier": "^5.2.5",
7574
"eslint-plugin-react": "^7.37.4",
7675
"long": "^5.3.1",
7776
"nice-grpc-web": "^3.3.6",
@@ -80,6 +79,7 @@
8079
"protobufjs": "^7.4.0",
8180
"terser": "^5.39.0",
8281
"typescript": "^5.8.2",
82+
"typescript-eslint": "^8.28.0",
8383
"vite": "^6.2.1"
8484
},
8585
"pnpm": {

0 commit comments

Comments
 (0)