Skip to content

Commit 0d2499a

Browse files
migrate ESLint 8 to 9
1 parent 5b2d88f commit 0d2499a

File tree

7 files changed

+3674
-1510
lines changed

7 files changed

+3674
-1510
lines changed

.eslintignore

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

.eslintrc.cjs

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

.github/dependabot.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ updates:
55
directory: '/'
66
schedule:
77
interval: 'daily'
8-
ignore:
9-
- dependency-name: 'eslint'

eslint.config.mjs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import path from 'node:path'
2+
import { fileURLToPath } from 'node:url'
3+
4+
import { fixupPluginRules } from '@eslint/compat'
5+
import { FlatCompat } from '@eslint/eslintrc'
6+
import js from '@eslint/js'
7+
import tsParser from '@typescript-eslint/parser'
8+
import jsxA11Y from 'eslint-plugin-jsx-a11y'
9+
import reactHooks from 'eslint-plugin-react-hooks'
10+
11+
const __filename = fileURLToPath(import.meta.url)
12+
const __dirname = path.dirname(__filename)
13+
const compat = new FlatCompat({
14+
baseDirectory: __dirname,
15+
recommendedConfig: js.configs.recommended,
16+
allConfig: js.configs.all,
17+
})
18+
19+
export default [
20+
{
21+
ignores: [
22+
'**/.vscode',
23+
'**/node_modules',
24+
'**/build',
25+
'**/dist',
26+
'**/.github',
27+
'**/.idea',
28+
'public/mockServiceWorker.js',
29+
],
30+
},
31+
...compat.extends('ts-prefixer', 'plugin:jsx-a11y/recommended'),
32+
{
33+
plugins: {
34+
'react-hooks': fixupPluginRules(reactHooks),
35+
'jsx-a11y': jsxA11Y,
36+
},
37+
38+
languageOptions: {
39+
globals: {},
40+
parser: tsParser,
41+
ecmaVersion: 5,
42+
sourceType: 'script',
43+
44+
parserOptions: {
45+
project: ['tsconfig.json'],
46+
},
47+
},
48+
49+
settings: {},
50+
51+
rules: {
52+
'react-hooks/rules-of-hooks': 'error',
53+
},
54+
},
55+
]

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"test": "vitest --run",
1717
"test:ui": "vitest --ui",
1818
"test:watch": "vitest",
19-
"lint": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs",
20-
"lint:fix": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs --fix",
19+
"lint": "eslint . -c eslint.config.mjs",
20+
"lint:fix": "eslint . -c eslint.config.mjs --fix",
2121
"typecheck": "tsc --noEmit",
2222
"prettier": "prettier --ignore-unknown --write .",
2323
"clean": "rimraf node_modules pnpm-lock.yaml dist",
@@ -32,6 +32,9 @@
3232
"react-router-dom": "^6.28.0"
3333
},
3434
"devDependencies": {
35+
"@eslint/compat": "^1.2.3",
36+
"@eslint/eslintrc": "^3.2.0",
37+
"@eslint/js": "^9.16.0",
3538
"@tailwindcss/aspect-ratio": "^0.4.2",
3639
"@tailwindcss/forms": "^0.5.9",
3740
"@tailwindcss/line-clamp": "^0.4.4",
@@ -40,18 +43,18 @@
4043
"@testing-library/jest-dom": "^6.6.3",
4144
"@testing-library/react": "^16.0.1",
4245
"@testing-library/user-event": "^14.5.2",
43-
"@types/eslint": "^8.56.7",
46+
"@types/eslint": "^9.6.1",
4447
"@types/react": "^18.3.12",
4548
"@types/react-dom": "^18.3.1",
46-
"@typescript-eslint/eslint-plugin": "^7.18.0",
47-
"@typescript-eslint/parser": "^7.18.0",
49+
"@typescript-eslint/eslint-plugin": "^8.16.0",
50+
"@typescript-eslint/parser": "^8.16.0",
4851
"@vitejs/plugin-react-swc": "^3.7.2",
4952
"@vitest/ui": "^1.4.0",
5053
"all-contributors-cli": "^6.26.1",
5154
"autoprefixer": "^10.4.20",
5255
"concurrently": "^9.1.0",
5356
"cross-fetch": "^4.0.0",
54-
"eslint": "^8.57.0",
57+
"eslint": "^9.16.0",
5558
"eslint-config-prettier": "^9.1.0",
5659
"eslint-config-ts-prefixer": "^1.14.0",
5760
"eslint-import-resolver-typescript": "^3.6.3",

0 commit comments

Comments
 (0)