58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
|
|
import { FlatCompat } from "@eslint/eslintrc";
|
||
|
|
import { dirname } from "path";
|
||
|
|
import { fileURLToPath } from "url";
|
||
|
|
|
||
|
|
const __filename = fileURLToPath(import.meta.url);
|
||
|
|
const __dirname = dirname(__filename);
|
||
|
|
|
||
|
|
const compat = new FlatCompat({
|
||
|
|
baseDirectory: __dirname,
|
||
|
|
recommendedConfig: {
|
||
|
|
env: { browser: true, es6: true, node: true },
|
||
|
|
extends: ["eslint:recommended"],
|
||
|
|
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
const eslintConfig = [
|
||
|
|
// Global ignores
|
||
|
|
{
|
||
|
|
ignores: [
|
||
|
|
".next/**",
|
||
|
|
"node_modules/**",
|
||
|
|
"out/**",
|
||
|
|
"dist/**",
|
||
|
|
"build/**",
|
||
|
|
"next-env.d.ts",
|
||
|
|
"*.config.js"
|
||
|
|
]
|
||
|
|
},
|
||
|
|
|
||
|
|
// Next.js recommended config
|
||
|
|
...compat.extends("next/core-web-vitals"),
|
||
|
|
|
||
|
|
// TypeScript specific config
|
||
|
|
...compat.extends("next/typescript"),
|
||
|
|
|
||
|
|
// Custom rules for all files
|
||
|
|
{
|
||
|
|
rules: {
|
||
|
|
// TypeScript rules
|
||
|
|
"@typescript-eslint/no-unused-vars": ["error", {
|
||
|
|
argsIgnorePattern: "^_",
|
||
|
|
varsIgnorePattern: "^_"
|
||
|
|
}],
|
||
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
||
|
|
"@typescript-eslint/consistent-type-imports": "warn",
|
||
|
|
|
||
|
|
// Console statements - warn in development
|
||
|
|
"no-console": process.env.NODE_ENV === "production" ? "error" : "warn",
|
||
|
|
|
||
|
|
// React/Next.js specific
|
||
|
|
"react/no-unescaped-entities": "off",
|
||
|
|
"@next/next/no-page-custom-font": "off",
|
||
|
|
}
|
||
|
|
}
|
||
|
|
];
|
||
|
|
|
||
|
|
export default eslintConfig;
|