Skip to content

Commit

Permalink
migrate ESLint 8 to 9
Browse files Browse the repository at this point in the history
  • Loading branch information
ryota-murakami committed Dec 2, 2024
1 parent 5b2d88f commit 0d2499a
Show file tree
Hide file tree
Showing 7 changed files with 3,674 additions and 1,510 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ updates:
directory: '/'
schedule:
interval: 'daily'
ignore:
- dependency-name: 'eslint'
55 changes: 55 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'

import { fixupPluginRules } from '@eslint/compat'
import { FlatCompat } from '@eslint/eslintrc'
import js from '@eslint/js'
import tsParser from '@typescript-eslint/parser'
import jsxA11Y from 'eslint-plugin-jsx-a11y'
import reactHooks from 'eslint-plugin-react-hooks'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
ignores: [
'**/.vscode',
'**/node_modules',
'**/build',
'**/dist',
'**/.github',
'**/.idea',
'public/mockServiceWorker.js',
],
},
...compat.extends('ts-prefixer', 'plugin:jsx-a11y/recommended'),
{
plugins: {
'react-hooks': fixupPluginRules(reactHooks),
'jsx-a11y': jsxA11Y,
},

languageOptions: {
globals: {},
parser: tsParser,
ecmaVersion: 5,
sourceType: 'script',

parserOptions: {
project: ['tsconfig.json'],
},
},

settings: {},

rules: {
'react-hooks/rules-of-hooks': 'error',
},
},
]
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"test": "vitest --run",
"test:ui": "vitest --ui",
"test:watch": "vitest",
"lint": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs",
"lint:fix": "eslint . --ext .ts,.tsx,.js,jsx,cjs,mjs --fix",
"lint": "eslint . -c eslint.config.mjs",
"lint:fix": "eslint . -c eslint.config.mjs --fix",
"typecheck": "tsc --noEmit",
"prettier": "prettier --ignore-unknown --write .",
"clean": "rimraf node_modules pnpm-lock.yaml dist",
Expand All @@ -32,6 +32,9 @@
"react-router-dom": "^6.28.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.16.0",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/line-clamp": "^0.4.4",
Expand All @@ -40,18 +43,18 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/eslint": "^8.56.7",
"@types/eslint": "^9.6.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"@vitest/ui": "^1.4.0",
"all-contributors-cli": "^6.26.1",
"autoprefixer": "^10.4.20",
"concurrently": "^9.1.0",
"cross-fetch": "^4.0.0",
"eslint": "^8.57.0",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-ts-prefixer": "^1.14.0",
"eslint-import-resolver-typescript": "^3.6.3",
Expand Down
Loading

0 comments on commit 0d2499a

Please sign in to comment.