Skip to content

fix(parser): reject module-referencing imports/exports in a namespace body#22829

Merged
Boshen merged 1 commit into
mainfrom
fix/namespace-body-module-refs
Jun 8, 2026
Merged

fix(parser): reject module-referencing imports/exports in a namespace body#22829
Boshen merged 1 commit into
mainfrom
fix/namespace-body-module-refs

Conversation

@Boshen

@Boshen Boshen commented May 29, 2026

Copy link
Copy Markdown
Member

Inside an internal namespace N {} / module N {}, statements that reference a
module are not permitted — this matches both babel and TypeScript:

  • import ... from "m" / import x = require("m") → TS1147
  • export ... from "m" / export * from "m" → TS1194
  • export default ... → TS1319
  • export = ... → TS1063

Bare export { x } (re-export of locals, no module source) and import x = A.B
(entity alias) stay valid, as do external modules (declare module "x" {}) where
these forms are allowed — the check only runs for internal namespaces, so those
never reach it.

Also removes TS1147 from the coverage denylist (NOT_SUPPORTED_ERROR_CODES), since
oxc now detects it.

Conformance (no regressions, positive/AST stay 100% everywhere):

  • parser_babel negative 1696 → 1704
  • parser_typescript negative 1585 → 1594

Boshen commented May 29, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the A-parser Area - Parser label May 29, 2026
@Boshen Boshen marked this pull request as ready for review May 29, 2026 10:57
@codspeed-hq

codspeed-hq Bot commented May 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 57 untouched benchmarks


Comparing fix/namespace-body-module-refs (56b18d9) with fix/const-modifier-type-alias (3ed3157)1

Open in CodSpeed

Footnotes

  1. No successful run was found on fix/const-modifier-type-alias (b817ee4) during the generation of this report, so 10095f7 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Boshen Boshen force-pushed the fix/namespace-body-module-refs branch 3 times, most recently from 4f6f0dd to 56b18d9 Compare May 29, 2026 14:37
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label May 31, 2026

Boshen commented May 31, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • May 31, 9:29 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 7, 1:46 AM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 7, 2:37 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 7, 3:03 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 8, 4:15 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 8, 4:31 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 8, 4:53 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 8, 4:53 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.

@Boshen Boshen changed the base branch from fix/const-modifier-type-alias to main May 31, 2026 09:43
@Boshen Boshen force-pushed the fix/namespace-body-module-refs branch from 56b18d9 to 8b0372b Compare June 5, 2026 06:43
Comment thread crates/oxc_parser/src/diagnostics.rs Outdated
@Boshen Boshen force-pushed the fix/namespace-body-module-refs branch from 8b0372b to a7c0320 Compare June 7, 2026 01:44
@Boshen Boshen added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Jun 7, 2026
@camc314 camc314 added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Jun 7, 2026
@Boshen Boshen added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Jun 7, 2026
@Boshen Boshen force-pushed the fix/namespace-body-module-refs branch from a7c0320 to 16947f0 Compare June 8, 2026 16:13
@Boshen Boshen added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Jun 8, 2026
@Boshen Boshen force-pushed the fix/namespace-body-module-refs branch from 16947f0 to af1e189 Compare June 8, 2026 16:31
@Boshen Boshen merged commit 8a04149 into main Jun 8, 2026
29 checks passed
@Boshen Boshen deleted the fix/namespace-body-module-refs branch June 8, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0-merge Merge with Graphite Merge Queue A-parser Area - Parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants