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
is clearer with parentheses, that is according to this style guide you'd need to write this as
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?
The ESLint rule no-mixed-operators is great for making things like
clearer by adding parentheses (rather than having people remember the precedence of
&&and||. That said, I'm unconvinced thatis clearer with parentheses, that is according to this style guide you'd need to write this as
The no-mixed-operators rule has an option for this,
allowSamePrecedenceand the default istruemeaning thatvar foo = a + b - cis valid code (which I think makes a lot more sense). Is there any reason for having this set tofalse?