Convert non-strict equality checking, using ==
, to the strict version, using ===
.
Details on StackOverflow.
Apply with the Grit CLI
grit apply enforce_strict_equality_check
Rewrite == to ===
BEFORE
if (x == 42) { foo; }
AFTER
if (x === 42) { foo; }
Rewrite != to !==
BEFORE
if (x != 42) { foo; }
AFTER
if (x !== 42) { foo; }
Doesn't apply when not necessary
JAVASCRIPT
if (foo) { foo; }
Doesn't apply when comparing with null
JAVASCRIPT
if (foo == null) { foo; }