This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
Commit fcdc4d0
fix(scripts): type js-comment-mask.mjs's parameters so consumer call sites are checked (#9423)
* fix(scripts): type js-comment-mask.mjs's parameters so consumer call sites are checked
`tsconfig.scripts.json` compiles `scripts/**` with `allowJs: true` and
`checkJs: false` on purpose (objectui#3494), so a `.ts` consumer's types for
these helpers come from inference over the `.mjs` source, steered by JSDoc and
by nothing else.
Four exports take parameters; only `scanSource` documented them. `blank` had a
one-line prose docblock, `stripComments` and `maskComments` had prose-only
multi-line ones -- so their parameters inferred `any` and every consumer call
site was accepted unchecked. Measured on this tree before the change:
`maskComments(12345)` -- a number passed to a string parameter -- type-checked
clean at exit 0. The error was not merely unreported, it was unreachable, which
is why objectui#9322 had to carry a hand-written
`const mask: (source: string) => string = maskComments;` to keep its one call
site checked.
`scanSource` is the control that proved the gap was the missing tag rather than
`allowJs` failing to type anything: it is imported alongside `maskComments` in
the same files, under the same config, and it was checked. It is left exactly as
it was.
No masking behaviour changes. All four exports were run over a nine-file corpus
of real repo sources (299,880 characters, 141,075 of them flagged as comment)
before and after, and every output digest is identical -- which matters because
several gates read this module as the single authority on "is this span a
comment, or code?".
The new test is what keeps the tags from being decorative. It compiles real
calls against the real module with the real project options and asserts the
DIAGNOSTIC rather than the tag's spelling: a wrong-typed argument must produce
TS2345 and a correctly-typed one must produce nothing. Deleting a `@param` again
makes the wrong-typed half stop erroring, which is the direction a grep for the
tag cannot see.
Part of objectui#9324
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
* fix(scripts): drop two dead declarations from the js-comment-mask param-type test
`Lint` was red on the repo-wide root run, and the single error in it was this
file's line 2: an unused `import fs`. `object-ui/no-unused-imports` is
error-level and `@typescript-eslint/no-unused-vars` is warning-level, so the
same finding was reported twice and only the first one failed the gate.
Both declarations are leftovers from an earlier draft that read the masker from
disk, before the harness switched to resolving it through the case file's own
relative import. Neither is scaffolding: counted over this file with comments
stripped, `fs` and `maskerPath` each occurred exactly once -- their own
declaration, with zero uses -- while `path`, `ts`, `repoRoot` and `configPath`
all hit as controls on the same input. So they are removed rather than renamed;
prefixing an underscore would have silenced the report without retiring the dead
code, and `maskerPath`'s report was only a warning and was failing nothing.
`scripts/js-comment-mask.mjs` is untouched, verified by blob hash. Nothing else
in the run is touched: the 32 warnings that remain are pre-existing, on
unrelated files.
`pnpm lint:root` exit 1 -> 0 (35 problems / 1 error -> 32 problems / 0 errors).
`pnpm type-check:scripts` exit 0. The param-type test and its neighbours still
pass: 4 files, 75 tests.
Part of objectui#9324
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 0a6372e commit fcdc4d0
3 files changed
Lines changed: 180 additions & 1 deletion
File tree
- .changeset
- scripts
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
440 | 446 | | |
441 | 447 | | |
442 | 448 | | |
| |||
465 | 471 | | |
466 | 472 | | |
467 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
468 | 477 | | |
469 | 478 | | |
470 | 479 | | |
| |||
481 | 490 | | |
482 | 491 | | |
483 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
484 | 496 | | |
485 | 497 | | |
486 | 498 | | |
| |||
0 commit comments