mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
77efb7698d
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.
```
4 lines
27 B
JavaScript
4 lines
27 B
JavaScript
switch (foo) {
|
|
caze 1:
|
|
}
|