-
-
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.
Warn for unexpected semicolon between else and opening brace.
- Loading branch information
1 parent
384c318
commit a4ce1c3
Showing
4 changed files
with
39 additions
and
20 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,13 @@ | ||
# E220: Semicolon after else may cause unexpected execution of its body. | ||
|
||
A semicolon next to the `else` keyword can cause its body to be executed even when previous `if` statement condition is true. | ||
|
||
if (true) { | ||
console.log("true"); | ||
} else; { | ||
console.log("& false"); | ||
} | ||
> true | ||
> & false | ||
|
||
To avoid this behavior, remove the semicolon between the else keyword and the opening brace of the else block. |
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
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
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