chore: migrate lint to eslint 9 flat config

Next 16 removed the `next lint` command, so `pnpm lint` was broken. Replace
.eslintrc.json with an ESLint 9 flat config (eslint.config.mjs) that spreads
eslint-config-next's native core-web-vitals flat config, and point the lint
script at `eslint .`.

Keep Next 16's newer react-hooks (v6) compiler-adjacent rules advisory (warn)
rather than blocking, since they flag working-but-non-optimal patterns across
the existing codebase. `pnpm lint` now passes (0 errors, warnings only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
isra el
2026-07-11 02:03:14 +03:00
parent 6fe0a5dde0
commit f821f480c7
4 changed files with 37 additions and 7 deletions

View File

@@ -1,6 +0,0 @@
{
"extends": "next/core-web-vitals",
"rules": {
"react/no-unescaped-entities": "off"
}
}

32
web/eslint.config.mjs Normal file
View File

@@ -0,0 +1,32 @@
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals'
// Next 16 removed `next lint`; eslint-config-next now ships a native ESLint 9
// flat config, so we spread it directly (this replaces the old .eslintrc.json).
const eslintConfig = [
...nextCoreWebVitals,
{
rules: {
'react/no-unescaped-entities': 'off',
// Next 16 enables the newer react-hooks (v6) compiler-adjacent rules by
// default. They flag working-but-non-optimal patterns across this
// pre-existing codebase, so keep them advisory (warn) rather than
// blocking; tighten to error as components are refactored.
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/purity': 'warn',
'react-hooks/static-components': 'warn',
'react-hooks/refs': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/incompatible-library': 'warn',
},
},
{
ignores: [
'.next/**',
'node_modules/**',
'test-results/**',
'playwright-report/**',
],
},
]
export default eslintConfig

View File

@@ -7,7 +7,7 @@
"build": "next build",
"vercel-build": "next build",
"start": "next start",
"lint": "next lint",
"lint": "eslint .",
"test": "vitest run",
"test:watch": "vitest",
"test:e2e": "playwright test",
@@ -63,6 +63,7 @@
"node": ">=18.17.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.6",
"@playwright/test": "^1.49.1",
"@tailwindcss/postcss": "^4.3.2",
"@testing-library/jest-dom": "^6.6.3",

3
web/pnpm-lock.yaml generated
View File

@@ -138,6 +138,9 @@ importers:
specifier: ^3.25.76
version: 3.25.76
devDependencies:
'@eslint/eslintrc':
specifier: ^3.3.6
version: 3.3.6
'@playwright/test':
specifier: ^1.49.1
version: 1.61.1