Skip to content

Commit 73bd043

Browse files
cliffhallclaude
andcommitted
chore(scripts): round-7 — guard .mts/.cts too; drop dead export
Responds to the round-7 @claude review of #1799: - Finding 1: verify-typecheck-coverage now requires a tsc pass for tracked `.mts`/`.cts` (not just `.ts`/`.tsx`), matching verify-format-coverage's extension set — `.mts` is already the shared-config idiom here, so a client `vitest.config.ts` → `.mts` rename can no longer drop out of both the tsconfig include and the guard's required set. No-op on today's tree (no client `.mts`/`.cts`); confirmed a tracked `.mts` with a type error is now caught. Ambient `.d.{ts,mts,cts}` stay excluded. - Nit 2: drop the unused `export` on `rootReachedCommands` (internal to the lib; nothing imports it, and scripts/ isn't eslint-gated to catch dead exports). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5
1 parent 464ae40 commit 73bd043

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎scripts/lib/npm-scripts.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function reachableScripts(scripts, entry = "validate") {
2727
}
2828

2929
/** The command strings of every script reachable from the root `validate`. */
30-
export function rootReachedCommands(rootScripts) {
30+
function rootReachedCommands(rootScripts) {
3131
return [...reachableScripts(rootScripts)]
3232
.map((n) => rootScripts?.[n])
3333
.filter((c) => typeof c === "string");

‎scripts/verify-typecheck-coverage.mjs‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ const repoRoot = path.resolve(
4646
// explicit list, mirroring `verify-format-coverage.mjs`'s `MANIFESTS`.
4747
const CLIENTS = ["clients/cli", "clients/tui", "clients/launcher"];
4848

49-
// Ambient declaration files are excluded from the required set: an unreferenced
50-
// `*.d.ts` shim (e.g. web's `vitest.shims.d.ts`) is type-only and not a real
51-
// gap. There are none under cli/tui/launcher today; this pre-empts one.
49+
// TypeScript source extensions this guard requires a tsc pass for. Matches its
50+
// sibling's TS set (`verify-format-coverage.mjs` — `.mts` is already the idiom
51+
// for shared config here, e.g. `vitest.shared.mts`, so a client `.mts`/`.cts`
52+
// must be gated too). Ambient declaration files are excluded: an unreferenced
53+
// `*.d.{ts,mts,cts}` shim (e.g. web's `vitest.shims.d.ts`) is type-only and not
54+
// a real gap. There are no client `.mts`/`.cts` today; this pre-empts one.
5255
const isRequiredSource = (rel) =>
53-
/\.(ts|tsx)$/.test(rel) && !rel.endsWith(".d.ts");
56+
/\.(ts|tsx|mts|cts)$/.test(rel) && !/\.d\.(ts|mts|cts)$/.test(rel);
5457

5558
/**
5659
* The tsconfig projects a client's `typecheck` names via `-p`/`--project`,
@@ -118,10 +121,11 @@ function projectFiles(clientDir, project) {
118121

119122
/** Tracked first-party `.ts`/`.tsx` under a client (excludes build output). */
120123
function trackedSourceFiles(clientDir) {
121-
const out = execFileSync("git", ["ls-files", "*.ts", "*.tsx"], {
122-
cwd: path.join(repoRoot, clientDir),
123-
encoding: "utf8",
124-
});
124+
const out = execFileSync(
125+
"git",
126+
["ls-files", "*.ts", "*.tsx", "*.mts", "*.cts"],
127+
{ cwd: path.join(repoRoot, clientDir), encoding: "utf8" },
128+
);
125129
return out
126130
.split("\n")
127131
.filter(Boolean)

0 commit comments

Comments
 (0)