|
1 | | -import { dirname } from "path"; |
2 | | -import { fileURLToPath } from "url"; |
3 | | -import { FlatCompat } from "@eslint/eslintrc"; |
4 | | - |
5 | | -const __filename = fileURLToPath(import.meta.url); |
6 | | -const __dirname = dirname(__filename); |
7 | | - |
8 | | -const compat = new FlatCompat({ |
9 | | - baseDirectory: __dirname, |
10 | | -}); |
| 1 | +import nextCoreWebVitals from "eslint-config-next/core-web-vitals"; |
| 2 | +import nextTypescript from "eslint-config-next/typescript"; |
| 3 | +import prettierConfig from "eslint-config-prettier/flat"; |
11 | 4 |
|
12 | 5 | const eslintConfig = [ |
13 | | - ...compat.extends("next/core-web-vitals", "next/typescript"), |
| 6 | + ...nextCoreWebVitals, |
| 7 | + ...nextTypescript, |
14 | 8 | { |
15 | 9 | ignores: [ |
16 | | - "node_modules/**", |
17 | | - ".next/**", |
| 10 | + "**/node_modules/**", |
| 11 | + "**/.next/**", |
| 12 | + ".worktrees/**", |
18 | 13 | "out/**", |
19 | 14 | "build/**", |
20 | 15 | "next-env.d.ts", |
21 | 16 | "references/**", |
22 | 17 | "subgraphs/**", |
| 18 | + "scripts/**", |
23 | 19 | ], |
24 | 20 | }, |
| 21 | + { |
| 22 | + // React Compiler rules shipped with eslint-plugin-react-hooks v7 (bundled with |
| 23 | + // Next.js 16). Correctness-critical rules stay as errors. `set-state-in-effect` |
| 24 | + // is disabled because it fires on the standard "fetch-in-effect → setState" |
| 25 | + // pattern that React docs explicitly permit for external-system sync; enforcing |
| 26 | + // it would require rewriting 30+ components without clear correctness win. |
| 27 | + rules: { |
| 28 | + "react-hooks/set-state-in-effect": "off", |
| 29 | + "react-hooks/error-boundaries": "error", |
| 30 | + "react-hooks/immutability": "error", |
| 31 | + "react-hooks/purity": "error", |
| 32 | + "react-hooks/refs": "error", |
| 33 | + "react-hooks/preserve-manual-memoization": "warn", |
| 34 | + "react-hooks/incompatible-library": "error", |
| 35 | + }, |
| 36 | + }, |
25 | 37 | // Disable rules that conflict with Prettier's formatting |
26 | | - ...compat.extends("prettier"), |
| 38 | + prettierConfig, |
27 | 39 | ]; |
28 | 40 |
|
29 | 41 | export default eslintConfig; |
0 commit comments