Files
oxc-project__oxc/tasks/coverage/misc/fail/switch-invalid-clause.js
sapphi-red 77efb7698d feat(parser): improve error message for invalid switch clauses (#15728)
Improved error message for invalid switch clauses.

**Before**
```
  x Unexpected token
   ,-[:2:3]
 1 | switch (foo) {
 2 |   caze 1:
   :   ^^^^
 3 | }
   `----
```

**After**
```
  × Expected switch clause
   ╭─[misc/fail/switch-invalid-clause.js:2:3]
 1 │ switch (foo) {
 2 │   caze 1:
   ·   ──┬─
   ·     ╰── `case` or `default` clause expected here
 3 │ }
   ╰────
  help: If this is intended to be the condition for the switch statement, add `case` before it.
```
2025-11-16 02:57:35 +00:00

4 lines
27 B
JavaScript