fix(ci): fix ESLint flat config plugin resolution

- Override react-hooks rules within the same config object that defines the plugin
- Avoids 'Cannot redefine plugin' error in ESLint 9 flat config
This commit is contained in:
saravanakumardb1 2026-03-22 21:20:23 -07:00
parent 7cca057831
commit 1168da3ce2

View File

@ -3,7 +3,21 @@ import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript"; import nextTs from "eslint-config-next/typescript";
const eslintConfig = defineConfig([ const eslintConfig = defineConfig([
...nextVitals, ...nextVitals.map((cfg) => {
// Downgrade React 19 strict rules to warnings (fix incrementally)
if (cfg?.rules?.["react-hooks/rules-of-hooks"]) {
return {
...cfg,
rules: {
...cfg.rules,
"react-hooks/rules-of-hooks": "warn",
"react-hooks/set-state-in-effect": "off",
"react-hooks/purity": "warn",
},
};
}
return cfg;
}),
...nextTs, ...nextTs,
// Override default ignores of eslint-config-next. // Override default ignores of eslint-config-next.
globalIgnores([ globalIgnores([
@ -15,10 +29,6 @@ const eslintConfig = defineConfig([
]), ]),
{ {
rules: { rules: {
// Downgrade React 19 strict rules to warnings (fix incrementally)
"react-hooks/rules-of-hooks": "warn",
"react-hooks/set-state-in-effect": "off",
"react-hooks/purity": "warn",
"@typescript-eslint/no-this-alias": "warn", "@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-require-imports": "warn", "@typescript-eslint/no-require-imports": "warn",
}, },