import { defineConfig, globalIgnores } from "eslint/config"; import { fixupConfigRules } from "@eslint/compat"; import nextVitals from "eslint-config-next/core-web-vitals"; import nextTs from "eslint-config-next/typescript"; // eslint-config-next still bundles eslint-plugin-react, eslint-plugin-import and // eslint-plugin-jsx-a11y, none of which have shipped an ESLint 10 release. They call // context methods that ESLint 10 removed (context.getFilename and friends), which makes // the whole run abort rather than report. fixupConfigRules re-adds those methods for the // affected rules. Tracked upstream in jsx-eslint/eslint-plugin-react#3977 and // vercel/next.js#89764 - drop this wrapper once eslint-config-next declares eslint 10. const eslintConfig = defineConfig([ ...fixupConfigRules(nextVitals), ...fixupConfigRules(nextTs), { rules: { "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-unused-vars": [ "error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" } ], // React Compiler correctness rules (eslint-plugin-react-hooks v7, pulled in by // eslint-config-next 16.2.10). We don't enable React Compiler (no `reactCompiler` // flag in next.config.ts), so these are advisory-only here and produce a large // number of false positives against standard fetch-in-effect patterns. Keep // exhaustive-deps and the other stable react-hooks rules enabled. "react-hooks/set-state-in-effect": "off", "react-hooks/purity": "off", "react-hooks/static-components": "off", "react-hooks/immutability": "off", "react-hooks/refs": "off", "react-hooks/incompatible-library": "off", "react-hooks/preserve-manual-memoization": "off" }, }, // Override default ignores of eslint-config-next. globalIgnores([ // Default ignores of eslint-config-next: ".next/**", "out/**", "build/**", "next-env.d.ts", // Docs (VitePress) build artifacts - not our code "docs/.vitepress/cache/**", "docs/.vitepress/dist/**", // Docs theme is Vue, not React - exclude from React rules "docs/.vitepress/theme/**", // API docs build artifacts - bundled third-party code "api-docs/dist/**", // Website - own independent Next.js project, own eslint config, own tooling "website/**", // Coverage reports - auto-generated by vitest "coverage/**", ]), ]); export default eslintConfig;