build(frontend)!: knip drops --production; plain knip stays

The production pass (7ed2ac4e, E32) asked "is this export used by what
ships?". No real hit: its only findings were 37 exports a test imports,
answered with 36 `@internal` JSDoc tags (E34 S2) — test-only exports, not
defects. Since then it has only ever asked for another tag. The tags go
with it (36, no longer read by anything), and so do the production-only
`!…!` exclusions in knip.jsonc and their register rows. Plain knip (unused
files, exports and dependencies) keeps running in the gate.
This commit is contained in:
2026-10-05 00:19:38 +02:00
parent 7e681e112e
commit 36653886d5
30 changed files with 12 additions and 68 deletions
+5 -5
View File
@@ -542,20 +542,20 @@ describe("the gate register (docs/gates.md)", () => {
});
// --- knip -----------------------------------------------------------------------------------------
it("lists every knip production exclusion and every other key, and runs both modes", () => {
it("lists every knip exclusion and every other key", () => {
const cfg = jsonc("frontend/knip.jsonc") as { project?: string[] } & Record<string, unknown>;
const found: [string, string][] = (cfg.project ?? [])
.filter((p) => p.startsWith("!"))
.map((p): [string, string] => ["--production", p]);
.map((p): [string, string] => ["knip", p]);
for (const key of Object.keys(cfg).filter(
(k) => !["$schema", "project", "playwright"].includes(k),
))
found.push(["knip", key]);
expect(missingFrom(found)).toEqual([]);
const pkg = JSON.parse(read("frontend/package.json")) as { scripts: Record<string, string> };
expect(pkg.scripts.knip).toBe("knip && knip --production");
// the positive pattern is the project itself: narrowing it drops files from both modes
expect((cfg.project ?? []).filter((p) => !p.startsWith("!"))).toEqual(["**/*.{ts,tsx,js}!"]);
expect(pkg.scripts.knip).toBe("knip");
// the positive pattern is the project itself: narrowing it drops files from the lane
expect((cfg.project ?? []).filter((p) => !p.startsWith("!"))).toEqual(["**/*.{ts,tsx,js}"]);
// and knip.jsonc is the config knip reads: a knip.json (read first) or a package.json `knip` key
// (merged in) would narrow it unseen (E32 review round 3)
const KNIP_FILES = /^\.?knip(\.config)?\.(json|jsonc|js|ts|mjs|cjs|mts|cts|toml|ya?ml)$/;