From 1168da3ce26dcc56acf6ec72dbc77b76c4fef654 Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Sun, 22 Mar 2026 21:20:23 -0700 Subject: [PATCH] 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 --- web/eslint.config.mjs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs index ff7f0b9..3cd302a 100644 --- a/web/eslint.config.mjs +++ b/web/eslint.config.mjs @@ -3,7 +3,21 @@ import nextVitals from "eslint-config-next/core-web-vitals"; import nextTs from "eslint-config-next/typescript"; 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, // Override default ignores of eslint-config-next. globalIgnores([ @@ -15,10 +29,6 @@ const eslintConfig = defineConfig([ ]), { 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-require-imports": "warn", },