76 lines
2.4 KiB
JavaScript
76 lines
2.4 KiB
JavaScript
import { createRequire } from "module";
|
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
// Manually configure Next.js ESLint without React Compiler plugin
|
|
const nextWebVitals = require("eslint-config-next/core-web-vitals");
|
|
const nextTypeScript = require("eslint-config-next/typescript");
|
|
const reactHooks = require("eslint-plugin-react-hooks");
|
|
|
|
// React Compiler rules to disable (from eslint-plugin-react-hooks v5+)
|
|
// See: https://react.dev/learn/react-compiler
|
|
const reactCompilerRules = {
|
|
"react-hooks/hooks": "off",
|
|
"react-hooks/capitalized-calls": "off",
|
|
"react-hooks/static-components": "off",
|
|
"react-hooks/use-memo": "off",
|
|
"react-hooks/void-use-memo": "off",
|
|
"react-hooks/preserve-manual-memoization": "off",
|
|
"react-hooks/memo-dependencies": "off",
|
|
"react-hooks/incompatible-library": "off",
|
|
"react-hooks/immutability": "off",
|
|
"react-hooks/globals": "off",
|
|
"react-hooks/refs": "off",
|
|
"react-hooks/memoized-effect-dependencies": "off",
|
|
"react-hooks/exhaustive-effect-dependencies": "off",
|
|
"react-hooks/set-state-in-effect": "off",
|
|
"react-hooks/no-deriving-state-in-effects": "off",
|
|
"react-hooks/error-boundaries": "off",
|
|
"react-hooks/purity": "off",
|
|
"react-hooks/set-state-in-render": "off",
|
|
"react-hooks/invariant": "off",
|
|
"react-hooks/todo": "off",
|
|
"react-hooks/syntax": "off",
|
|
"react-hooks/unsupported-syntax": "off",
|
|
"react-hooks/config": "off",
|
|
"react-hooks/gating": "off",
|
|
"react-hooks/rule-suppression": "off",
|
|
"react-hooks/fbt": "off",
|
|
"react-hooks/component-hook-factories": "off",
|
|
};
|
|
|
|
const eslintConfig = defineConfig([
|
|
...nextWebVitals,
|
|
...nextTypeScript,
|
|
globalIgnores([
|
|
".next/**",
|
|
".venv-i18n/**",
|
|
"out/**",
|
|
"build/**",
|
|
"next-env.d.ts",
|
|
"scripts/**",
|
|
"prisma/**",
|
|
"socket-server.ts",
|
|
"tests/**",
|
|
]),
|
|
{
|
|
plugins: {
|
|
"react-hooks": reactHooks,
|
|
},
|
|
rules: {
|
|
...reactCompilerRules,
|
|
"react-hooks/rules-of-hooks": "error",
|
|
"@typescript-eslint/no-unused-vars": "off",
|
|
"@typescript-eslint/no-explicit-any": "off",
|
|
"react/no-unescaped-entities": "off",
|
|
"@next/next/no-img-element": "off",
|
|
"jsx-a11y/role-has-required-aria-props": "off",
|
|
"@typescript-eslint/no-unused-expressions": "off",
|
|
"prefer-const": "error",
|
|
},
|
|
},
|
|
]);
|
|
|
|
export default eslintConfig;
|