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
This commit is contained in:
gsxdsm
2026-06-20 04:11:33 -07:00
parent a98a0ae23e
commit 3bda46dbd5
2 changed files with 45 additions and 0 deletions

View File

@@ -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/**",

View File

@@ -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",
);
});