-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not entirely move else branch if another else branch might acciden…
…tally be referenced.
- Loading branch information
1 parent
13f18ef
commit ad6b54d
Showing
3 changed files
with
46 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
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,7 @@ | ||
module.exports = { | ||
description: | ||
'do not catch else branches from parent if statements when simplifiying if-statements', | ||
context: { | ||
unknown: true | ||
} | ||
}; |
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,22 @@ | ||
if (unknown) | ||
for (var x = 1; x--; x > 0) | ||
if (!unknown) console.log('effect'); | ||
else 'Side effect free code to be dropped'; | ||
else throw new Error("Shouldn't be reached"); | ||
|
||
if (unknown) | ||
for (var x = 1; x--; x > 0) | ||
if ((console.log(), false)) console.log('effect'); | ||
else 'Side effect free code to be dropped'; | ||
else throw new Error("Shouldn't be reached"); | ||
|
||
if (unknown) { | ||
for (var x = 1; x--; x > 0) | ||
if (!unknown) console.log('effect'); | ||
else 'Side effect free code to be dropped'; | ||
} else throw new Error("Shouldn't be reached"); | ||
|
||
if (unknown) | ||
for (var x = 1; x--; x > 0) | ||
if (!unknown) console.log('effect'); | ||
else 'Side effect free code to be dropped'; |