lint/noUselessElse
incorrectly flags valid else
#924
Labels
A-Linter
Area: linter
L-JavaScript
Language: JavaScript and super languages
S-Enhancement
Status: Improve an existing feature
Environment information
What happened?
This an overly simplified example to trigger the bug:
https://biomejs.dev/playground/?indentStyle=space"eStyle=single&trailingComma=none&code=ZgB1AG4AYwB0AGkAbwBuACAAdABlAHMAdAAoACkAIAB7AAoAIAAgAGwAZQB0ACAAdgBhAGwAdQBlADsACgAKACAAIABpAGYAIAAoAGEAKQAgAHsACgAgACAAIAAgAHYAYQBsAHUAZQAgAD0AIAAxADsACgAgACAAfQAgAGUAbABzAGUAIABpAGYAIAAoAGIAKQAgAHsACgAgACAAIAAgAHIAZQB0AHUAcgBuACAAMgA7AAoAIAAgAH0AIABlAGwAcwBlACAAewAKACAAIAAgACAAdgBhAGwAdQBlACAAPQAgADMAOwAKACAAIAB9AAoACgAgACAAcgBlAHQAdQByAG4AIAB2AGEAbAB1AGUAOwAKAH0ACgA%3D
Expected result
If I follow biome's suggestions with the above code, I'll end up with
which breaks the previous logic.
If the
a
condition is truthy, then the lastelse
should not run, regardless of what theb
condition/block does.Code of Conduct
The text was updated successfully, but these errors were encountered: