Skip to content

Commit 1a3ce1a

Browse files
committed
Upgrade ESLint to 9.15
1 parent f1444bc commit 1a3ce1a

File tree

7 files changed

+319
-330
lines changed

7 files changed

+319
-330
lines changed

ui/frontend/.eslintrc.js

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

ui/frontend/.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ node_modules
1212
*.scss
1313

1414
# Slowly migrate files that we've touched
15-
!.eslintrc.js
1615
!BuildMenu.tsx
1716
!ButtonSet.tsx
1817
!Header.tsx
@@ -32,6 +31,7 @@ node_modules
3231
!editor/MonacoEditorCore.tsx
3332
!editor/SimpleEditor.tsx
3433
!editor/rust_monaco_def.ts
34+
!eslint.config.mjs
3535
!hooks.ts
3636
!observer.ts
3737
!prism-shim.ts

ui/frontend/Icon.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import React from 'react';
22

33
import * as styles from './Icon.module.css';
44

5-
/* eslint-disable max-len */
6-
75
// These icons came from Material Design originally
86
// https://material.io/tools/icons/?icon=assignment&style=outline
97

@@ -30,7 +28,6 @@ export const MoreOptionsIcon = () => (
3028

3129
export const MoreOptionsActiveIcon = () => (
3230
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
33-
{/* eslint-disable-next-line react/no-unknown-property */}
3431
<path fillRule="evenodd" fill="#428bca" d="M4,5 h16 a3,3 0 0,1 3,3 v8 a3,3 0 0,1 -3,3 h-16 a3,3 0 0,1 -3,-3 v-8 a3,3 0 0,1 3,-3 Z M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
3532
</svg>
3633
);

ui/frontend/eslint.config.mjs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// @ts-check
2+
import { fixupPluginRules } from '@eslint/compat';
3+
import eslint from '@eslint/js';
4+
import reactPlugin from 'eslint-plugin-react';
5+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
6+
import tseslint from 'typescript-eslint';
7+
8+
export default tseslint.config(
9+
eslint.configs.recommended,
10+
tseslint.configs.recommended,
11+
reactPlugin.configs.flat.recommended,
12+
13+
{
14+
plugins: {
15+
'react-hooks': fixupPluginRules(reactHooksPlugin),
16+
},
17+
18+
settings: {
19+
react: {
20+
version: 'detect',
21+
},
22+
},
23+
24+
rules: {
25+
'no-restricted-syntax': [
26+
'error',
27+
{
28+
message: 'Use `useAppDispatch` instead',
29+
selector: 'CallExpression[callee.name="useDispatch"]',
30+
},
31+
{
32+
message: 'Use `useAppSelector` instead',
33+
selector: 'CallExpression[callee.name="useSelector"]',
34+
},
35+
],
36+
37+
'@typescript-eslint/no-explicit-any': 'off',
38+
'@typescript-eslint/no-unused-vars': [
39+
'error',
40+
{
41+
args: 'all',
42+
argsIgnorePattern: '^_',
43+
caughtErrors: 'all',
44+
caughtErrorsIgnorePattern: '^_',
45+
destructuredArrayIgnorePattern: '^_',
46+
varsIgnorePattern: '^_',
47+
ignoreRestSiblings: true,
48+
},
49+
],
50+
'@typescript-eslint/no-use-before-define': [
51+
'error',
52+
{
53+
functions: false,
54+
variables: false,
55+
},
56+
],
57+
58+
'react/jsx-boolean-value': ['error', 'never'],
59+
60+
...reactHooksPlugin.configs.recommended.rules,
61+
62+
// Disabled to upgrade to eslint 9
63+
'no-empty': 'off',
64+
'no-useless-escape': 'off',
65+
'no-fallthrough': 'off',
66+
'@typescript-eslint/no-empty-object-type': 'off',
67+
},
68+
},
69+
);

ui/frontend/package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@babel/core": "^7.0.0",
3333
"@babel/preset-env": "^7.0.0",
3434
"@babel/preset-react": "^7.0.0",
35+
"@eslint/compat": "^1.2.3",
3536
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
3637
"@types/common-tags": "^1.8.1",
3738
"@types/jest": "^29.2.5",
@@ -44,18 +45,15 @@
4445
"@types/react-portal": "^4.0.4",
4546
"@types/route-parser": "^0.1.4",
4647
"@types/uuid": "^10.0.0",
47-
"@typescript-eslint/eslint-plugin": "^7.5.0",
48-
"@typescript-eslint/parser": "^7.5.0",
4948
"autoprefixer": "^10.2.4",
5049
"babel-loader": "^9.1.2",
5150
"basename": "^0.1.2",
5251
"compression-webpack-plugin": "^11.0.0",
5352
"copy-webpack-plugin": "^12.0.2",
5453
"css-loader": "^7.1.2",
55-
"eslint": "^8.6.0",
56-
"eslint-config-prettier": "^9.0.0",
54+
"eslint": "^9.15.0",
5755
"eslint-plugin-react": "^7.14.3",
58-
"eslint-plugin-react-hooks": "^4.0.0",
56+
"eslint-plugin-react-hooks": "^5.0.0",
5957
"glob": "^11.0.0",
6058
"html-webpack-plugin": "^5.2.0",
6159
"jest": "^29.3.1",
@@ -77,6 +75,7 @@
7775
"ts-jest": "^29.0.4",
7876
"ts-loader": "^9.2.3",
7977
"typescript": "^5.0.2",
78+
"typescript-eslint": "^8.15.0",
8079
"typescript-plugin-css-modules": "^5.0.0",
8180
"webpack": "^5.24.3",
8281
"webpack-cli": "^5.0.1"

0 commit comments

Comments
 (0)