Skip to content

Commit

Permalink
feat: add error docs for E0423
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmasani committed Oct 21, 2023
1 parent b23aa3e commit 731cce5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/errors/E0423.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# E0423: missing fallthrough comment in switch case

Switch Cases in javascript fallthrough to the next case if the `break` statement is not added at the end of the case.
Since there is no explicit way of communication whether the fallthrough is intentional or not, it is recommended to use a comment indicating fallthrough.

```javascript
function test (c) {
switch (c) {
case 1:
foo();
default:
bar();
}
}
```

To fix this error, place a comment at the end of `case 1` indicating fallthrough

```javascript
function test (c) {
switch (c) {
case 1:
foo();
//fallthrough
default:
bar();
}
}
```

0 comments on commit 731cce5

Please sign in to comment.