chore: add a dead-code check for the frontend scripts

src/web/public is plain <script> files with no imports, so knip cannot
follow it and ESLint does not cover it; leftovers there went unnoticed
until this cleanup. `npm run check:frontend-dead` is the counterpart of
`npm run knip` for that tree:

- JavaScript: every function, method and top-level binding, counted
  against the identifiers and string literals of the frontend files,
  index.html (inline handlers), the gesture overlay's source and the
  tests. A name with no reference but its own definition fails the check.
- CSS: every class and id of styles.css and mobile.css against the same
  text. A class built at runtime is recognised by its prefix or suffix.
- `--production` also lists what only tests reference.

It parses with the TypeScript compiler and PostCSS, both already dev
dependencies. Clean on this tree; run against the tree before the
cleanup it reports the 28 functions and 43 selectors that were removed.
On demand for now, not a CI step.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-13 20:39:05 +01:00
1 parent 75ea908f29
commit 574eae72f3
3 files changed
+272

No files matched your search

+1
View File
@@ -29,6 +29,7 @@
"pretest:mobile": "node scripts/prepare-test-vendor.mjs",
"test:mobile": "vitest run --config test/mobile/vitest.config.ts",
"check:frontend-syntax": "node scripts/check-frontend-syntax.mjs",
"check:frontend-dead": "node scripts/check-frontend-dead-code.mjs",
"check:browser-excludes": "node scripts/check-browser-test-excludes.mjs",
"check:local-model-catalog": "tsx scripts/check-local-model-catalog.mjs",
"fix:node-pty": "node scripts/fix-node-pty.mjs",