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 - c
is clearer with parentheses, that is according to this style guide you'd need to write this as
var foo = (a + b) - c
The 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
?
Metadata
Metadata
Assignees
Labels
No labels