Files
oxc-project__oxc/tasks/coverage/misc/fail/imbalanced-export-expr.js
sapphi-red d4f6545078 feat(parser): improve error message for missing closing tokens (#15269)
Improves error message for imbalanced tokens.
```
 × Expected `,` or `]` but found `const`
   ╭─[misc/fail/imbalanced-array-expr.js:2:1]
 1 │ const foo = [0, 1
   ·             ┬
   ·             ╰── Opened here
 2 │ const bar = 2
   · ──┬──
   ·   ╰── `,` or `]` expected
   ╰────
```

The error message for this case was:
```
  x Expected `,` but found `const`
   ,-[:2:1]
 1 | const foo = [0,1
 2 | const bar = 2
   : ^^|^^
   :   `-- `,` expected
   `----
```

This change makes it clear why the parser is expecting `,` and also tell that it can be fixed by adding the closing token somewhere.
2025-11-04 13:13:00 +00:00

4 lines
29 B
JavaScript