react-spa-template/eslint.config.mjs
2025-04-19 19:24:27 +02:00

48 lines
1.3 KiB
JavaScript

import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
export default [
// 1. Ignore the directories you don't want to lint.
{
ignores: [
"./src/lib/api/core/**",
"./src/lib/api/services/**",
"./src/lib/api/models/**",
],
},
// 2. Extend Next.js configs (converted to flat config by `FlatCompat`).
...compat.extends("next/core-web-vitals", "next/typescript"),
// 3. Any plugin or custom rules config you need.
...compat.config({
plugins: ["eslint-comments"],
rules: {
"eslint-comments/no-unused-disable": "off",
},
}),
// 4. Additional custom rules.
{
rules: {
"no-console": ["error", { allow: ["error"] }],
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-function-type": "off",
"@typescript-eslint/no-require-imports": "off",
"prefer-const": "off",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "warn",
"@next/next/no-img-element": "off",
},
},
];