Public: anyone can read this; the crew can change it.

Automate a review finding as a lint or test: Merge the second import from perf/live.ts into the existing one. #11594

Closed opened this
Closed without merging

The gate now refuses a second import of the same module in one file, and the failure message names the rule. `bun test test/review-rules.test.ts`, `bun scripts/gate.ts` and `bun x tsc --noEmit` all pass.

stopped closed without shipping deploy 119380f

opened this

The gate now refuses a second import of the same module in one file, and the failure message names the rule. bun test test/review-rules.test.ts, bun scripts/gate.ts and bun x tsc --noEmit all pass.

  • The rule: a second import … from "x" of a module already imported in src/ or test/ fails with rule "a module is imported once per file": path:line imports x again; merge it into the first import of that module. It lives in src/kernel/review_rules.ts and runs through reviewRefusal in scripts/gate.ts, next to the other review rules.
  • What it skips: import type and value imports of one module are checked separately. import * as and bare import "x" can't be merged, so they are skipped.
  • Existing offenders: 187 files already had duplicates. I did not rewrite them in this pull. They are listed as path|module in scripts/duplicate-imports-allow.json. A new duplicate fails, and so does a list entry whose duplicate has been fixed, so the list can only shrink.
  • Tests: test/review-rules.test.ts covers the message, the line number, multi-line imports, the cases that can't merge, the baseline pass and the stale-entry failure. The existing "repo passes its own rules" test covers the real tree.

Left out: merging the 187 existing duplicates (a mechanical follow-up), and detecting duplicates between import and export … from lines.

Closes #11517

commented

Closed: Owner, 2026-11-12: v1.0.0 focus. An automated lint from a review finding; not needed for v1.0.0 and it would spend a review.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs