From eed654418eb42e8fdf34f326a5204ac9a1fe8914 Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Sat, 23 May 2026 17:15:09 -0700 Subject: [PATCH] fix(admin-web/eslint): hoist .cjs ignore to index-0 ignores block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous fix (commit a4ee36b6) added '.pnpmfile.cjs' to the globalIgnores() call at the END of the admin-web eslint config, but flat-config v9 only applies ignores from the FIRST config object that contains an 'ignores' key — every subsequent config item is matched against the file before the late ignore is read. That's why CI run 66 still failed with the same require() error even after the dashboard-level ignore was in place. Fix: declare an explicit '{ ignores: [...] }' at array index 0, which is the documented eslint v9 pattern for skipping files before any rule config attaches: defineConfig([ { ignores: ['**/.pnpmfile.cjs', '**/*.cjs'] }, // <-- now first ...nextVitals, ...nextTs, { rules: { ... } }, globalIgnores([ ... ]), ]) Verified locally: cd dashboards/admin-web && npx eslint . -> 0 errors, 0 warnings --- dashboards/admin-web/eslint.config.mjs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dashboards/admin-web/eslint.config.mjs b/dashboards/admin-web/eslint.config.mjs index 5a14310e..0e5c7d42 100644 --- a/dashboards/admin-web/eslint.config.mjs +++ b/dashboards/admin-web/eslint.config.mjs @@ -3,6 +3,19 @@ import nextVitals from "eslint-config-next/core-web-vitals"; import nextTs from "eslint-config-next/typescript"; const eslintConfig = defineConfig([ + // Ignores MUST come first so they apply to every subsequent + // config item. globalIgnores() at the bottom of the array works + // for *.next / out / build / next-env.d.ts because eslint-config- + // next handles those internally, but .pnpmfile.cjs is not in that + // default list — declaring an explicit `{ ignores: [...] }` block + // at index 0 is the documented way to make eslint v9 skip files + // entirely before any config rules apply. + { + ignores: [ + "**/.pnpmfile.cjs", + "**/*.cjs", + ], + }, ...nextVitals, ...nextTs, {