Repository navigation
Check exported TypeScript types for readers again, reading them with oxc - #2674
Merged
Merged
Conversation
tests/js_facts.mjs parsed TypeScript by blanking its types with amaro and handing the rest to acorn, so the unused-export check stopped seeing the 46 types and interfaces the TypeScript modules export. It now parses JavaScript and TypeScript alike with oxc-parser, which returns one ESTree for both, so those exports are checked like values again. acorn and amaro stay for their other users. Checking each newly read type against its real importers found one unused: `Revision` in build/browser/domain.ts, which only domain.ts uses and which the word search counted as read through the unrelated word "Revision" elsewhere. It loses its `export`. No user-visible behaviour changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
approved these changes
Oct 12, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 12, 2026
The unused-export check (`tests/model/test_unused_exports.py`) counted an export as read wherever its name appeared as a word in any tracked file, so an export used only in its own module passed whenever an unrelated file shared the word. `Revision` in `build/browser/domain.ts` passed that way for weeks (#2674). `tests/js_facts.mjs` gains an `imports` reading that resolves each read to the exporting file: named imports, re-exports, `export *` forwarding, TypeScript and JSDoc `import("…").Name` types, and namespace use, static or through `import()` (member reads, destructuring, `.then` handlers, through `await`, conditionals and tests). It resolves extensionless and `.js`-for-`.ts` specifiers, the served `/runtime/`, `/vendor/`, `/widgets/` and `/checks/` paths, and a committed bundle compiled from one module of this tree (`vendor/browser-runtime.js`) to that module. Vendored bundles' own imports now count as readers, since what a bundle left external is what it reads. A name taken from an `import()` of a computed specifier reads that name in any module. The Worker's entry (`worker/wrangler.toml`'s `main`) counts as read whole, since the Workers runtime reads its exports by name (`ContainerProxy`). The word search remains only for readers that are not JavaScript: Python tests, pages and prose. The docstring names each of these readers. The stricter check flagged three exports nothing reads: `accompaniedThread` and `accompanyThread` in `thread/landing.js` and `isAddressable` in `thread/model.js`. Reviewing the 77 exports that only the word search still passes found three more that only share a word with a reader: the `SAY_BOX` re-export in `thread/landing.js` (tests read `thread/selectors.js`'s), `offerElement` in `widget-elements.js`, and `generated` in `.github/scripts/dependency-bundles.mjs`. All six are unexported or removed. The served-path mapping `tests/runtime/dom.mjs` used moves to `tests/served-paths.mjs`, which `js_facts.mjs` shares. Restoring `export` on `isAddressable`, which `design.js` names because it imports `anchor-resolution.js`'s, fails the new check and passes the old one. No user-visible behaviour changed. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tests/js_facts.mjs(#2666) parsed TypeScript by blanking its types with amaro and handing the rest to acorn, so the unused-export check (tests/model/test_unused_exports.py) stopped seeing the 47 types and interfaces the TypeScript modules export. It now parses JavaScript and TypeScript alike withoxc-parser(new devDependency, 0.153.0, which shares@oxc-project/typeswith rolldown), which returns one ESTree for both, so those exports are checked like values again. One parse path serves every command;keydownderives its line from the node's offset, since oxc gives noloc. acorn and amaro stay inpackage.jsonfor their other users.Checking each newly read type against its real importers found one unused:
Revisioninbuild/browser/domain.ts, which onlydomain.tsuses and which the word search counted as read through the unrelated word "Revision" elsewhere. It loses itsexport. The other 46 each have an importer (a TypeScript import, a JSDocimport("…").Name, or a namespace import of the generated contract files).No user-visible behaviour changes.
Checked:
test_unused_exports.py,test_owner_index.py, and thetest_interact_layer.pytests that calljs_factspass; adding an unreadexport interfacetosnapshot.tsfails the unused-export check;pnpm run checkpasses.