diff --git a/eslint.config.mjs b/eslint.config.mjs index 383f64b224..a26a64c387 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -126,6 +126,12 @@ export default tseslint.config( "**/dist/**", "**/out/**", "**/build/**", + // FNXC:LintConfig 2026-06-20-03:19: + // Capacitor `npx cap sync` copies the dashboard web bundle (minified, gitignored, + // untracked) into the Android app. ESLint flat config does not read .gitignore, + // so these artifacts must be explicitly ignored or they flood lint with + // no-unused-expressions / no-undef errors (FN-6775). + "packages/mobile/android/app/src/main/assets/public/**", "coverage/**", // Project metadata (fn data, worktrees, etc.) ".fusion/**", diff --git a/scripts/__tests__/eslint-ignores-mobile-synced-assets.test.mjs b/scripts/__tests__/eslint-ignores-mobile-synced-assets.test.mjs new file mode 100644 index 0000000000..731917056b --- /dev/null +++ b/scripts/__tests__/eslint-ignores-mobile-synced-assets.test.mjs @@ -0,0 +1,39 @@ +import assert from "node:assert/strict"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import test from "node:test"; + +/* +FNXC:LintConfig 2026-06-20-03:19: +Capacitor sync writes the dashboard web bundle into the Android app as gitignored generated assets. ESLint flat config does not inherit .gitignore, so this guard keeps synced mobile artifacts out of lint while preserving lint coverage for real source files. +*/ + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const repoRoot = path.resolve(__dirname, "../.."); + +function fromRoot(relativePath) { + return path.join(repoRoot, relativePath); +} + +test("ESLint ignores Capacitor-synced Android web assets but not real source", async () => { + const { ESLint } = await import("eslint"); + const eslint = new ESLint({ cwd: repoRoot }); + + assert.equal( + await eslint.isPathIgnored(fromRoot("packages/mobile/android/app/src/main/assets/public/assets/app-B2ZxMfJT.js")), + true, + "synced Android JavaScript bundle should be ignored", + ); + + assert.equal( + await eslint.isPathIgnored(fromRoot("packages/mobile/android/app/src/main/assets/public/sw.js")), + true, + "non-bundle synced Android public assets should be ignored", + ); + + assert.equal( + await eslint.isPathIgnored(fromRoot("packages/core/src/index.ts")), + false, + "tracked package source should remain linted", + ); +});