-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Closed
Description
The ESLint rule no-mixed-operators is great for making things like
var foo = a && b < 0 || c > 0 || d + 1 === 0;
var bar = a && b || c;clearer by adding parentheses (rather than having people remember the precedence of && and ||. That said, I'm unconvinced that
var foo = a + b - cis clearer with parentheses, that is according to this style guide you'd need to write this as
var foo = (a + b) - cThe no-mixed-operators rule has an option for this, allowSamePrecedence and the default is true meaning that var foo = a + b - c is valid code (which I think makes a lot more sense). Is there any reason for having this set to false?
laurentgoudet, tonybaroneee, ahutchings, jeff-bernstein, ndbroadbent and 7 more
Metadata
Metadata
Assignees
Labels
No labels