From 3bda46dbd5490808baac51c155863974f46e39b2 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Sat, 20 Jun 2026 04:11:33 -0700 Subject: [PATCH] FN-6775: ignore synced mobile assets in lint Keep generated Capacitor Android web assets out of ESLint while preserving source lint coverage. - Add an ESLint flat-config ignore for Capacitor-synced Android public assets. - Add a node:test regression guard proving synced mobile assets are ignored and real package source remains linted. Files changed: eslint.config.mjs | 6 ++++ .../eslint-ignores-mobile-synced-assets.test.mjs | 39 ++++++++++++++++++++++ 2 files changed, 45 insertions(+) Fusion-Task-Id: FN-6775 Fusion-Task-Lineage: 4bab7695-70b5-4a8c-b7de-6e0055ff4b9f --- eslint.config.mjs | 6 +++ ...lint-ignores-mobile-synced-assets.test.mjs | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 scripts/__tests__/eslint-ignores-mobile-synced-assets.test.mjs 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", + ); +});