Bitwise operators &
or |
are often used by mistake instead of &&
or ||
, which can cause unexpected errors.
Apply with the Grit CLI
grit apply no_bitwise
&
⇒ &&
BEFORE
var z = x & y;
AFTER
var z = x && y;
|
⇒ ||
BEFORE
var x = y | z;
AFTER
var x = y || z;
Do no change &&
and ||
operators
JAVASCRIPT
var c = a && b; var k = p || t;