mirror of
https://github.com/jnsahaj/tweakcn.git
synced 2026-08-29 07:14:31 +08:00
7280efb5f8
Replace FlatCompat-based eslint-config-next with direct plugin imports to fix "Unexpected top-level property name" error. This avoids the incompatibility between eslint-config-next and ESLint 9's flat config format. - Use @next/eslint-plugin-next directly - Use eslint-plugin-react directly - Use only classic react-hooks rules (not React Compiler rules) - Add typescript-eslint for TypeScript support - Update eslint-config-next to 15.4.10 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
74 lines
1.8 KiB
JavaScript
74 lines
1.8 KiB
JavaScript
import { dirname } from "path";
|
|
import { fileURLToPath } from "url";
|
|
import nextPlugin from "@next/eslint-plugin-next";
|
|
import reactPlugin from "eslint-plugin-react";
|
|
import hooksPlugin from "eslint-plugin-react-hooks";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const eslintConfig = [
|
|
{
|
|
plugins: {
|
|
"@next/next": nextPlugin,
|
|
},
|
|
rules: {
|
|
...nextPlugin.configs.recommended.rules,
|
|
...nextPlugin.configs["core-web-vitals"].rules,
|
|
"@next/next/no-page-custom-font": "off",
|
|
"@next/next/no-img-element": "off",
|
|
},
|
|
},
|
|
{
|
|
plugins: {
|
|
react: reactPlugin,
|
|
},
|
|
rules: {
|
|
...reactPlugin.configs.recommended.rules,
|
|
"react/react-in-jsx-scope": "off",
|
|
"react/prop-types": "off",
|
|
"react/no-unknown-property": "off",
|
|
"react/jsx-no-target-blank": "off",
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
},
|
|
},
|
|
{
|
|
plugins: {
|
|
"react-hooks": hooksPlugin,
|
|
},
|
|
rules: {
|
|
// Only use classic react-hooks rules (not React Compiler rules)
|
|
"react-hooks/rules-of-hooks": "error",
|
|
"react-hooks/exhaustive-deps": "warn",
|
|
},
|
|
},
|
|
...tseslint.configs.recommended,
|
|
{
|
|
rules: {
|
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
args: "all",
|
|
argsIgnorePattern: "^_",
|
|
caughtErrors: "all",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
destructuredArrayIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
ignores: [".next/**", "node_modules/**"],
|
|
},
|
|
];
|
|
|
|
export default eslintConfig;
|