sindresorhus/eslint-plugin-unicorn
Rule proposal: mistaken parentheses
Closed
#1,796 opened on Apr 19, 2022
help wantednew rule
Repository metrics
- Stars
- (5,022 stars)
- PR merge metrics
- (Avg merge 1d 16h) (399 merged PRs in 30d)
Description
Description
There's a certain type of errors that can be hard to spot and will work fine. Since it's valid to do operations like || in this context is it even possible to have a rule that could notice when you might have meant the other one?
Fail
This is what you wrote
str.startsWith('str' || str.startsWith('str'))
Pass
This is what you meant
str.startsWith('str') || str.startsWith('str')
Additional Info
No response