-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b23aa3e
commit 731cce5
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
``` |