feat(parser): improve error message for missing namespace/module names#15720
feat(parser): improve error message for missing namespace/module names#15720
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
CodSpeed Performance ReportMerging #15720 will not alter performanceComparing Summary
Footnotes
|
|
@camc314 Just in case you're not aware, tests failing. I'm not sure if the error in the diff is correct or not. |
fa9fd0f to
9729540
Compare
3f85660 to
646d020
Compare
9729540 to
704b561
Compare
704b561 to
d230bf8
Compare
d230bf8 to
53015ea
Compare
1ea734c to
f7ef032
Compare
**BEFORE:**
When parsing `declare namespace {` or `module {`, oxc reported:
```
"Expected a semicolon or an implicit semicolon after a statement, but found none"
```
This was confusing because the actual issue is a missing name, not a semicolon.
**AFTER:**
Now reports TypeScript-compatible error TS(1437):
```
"Namespace must be given a name."
"Module must be given a name."
```
53015ea to
6d0b1b5
Compare
Boshen
left a comment
There was a problem hiding this comment.
I don't like the parse_binding_identifier_with_error function, will take a look later.

BEFORE:
When parsing
declare namespace {ormodule {, oxc reported:This was confusing because the actual issue is a missing name, not a semicolon.
AFTER:
Now reports TypeScript-compatible error TS(1437):