π Disallow unnecessary comparisons against boolean literals.
πΌπ« This rule is enabled in the β
recommended config. This rule is disabled in the βοΈ unopinionated config.
π§ This rule is automatically fixable by the --fix CLI option.
Comparing a value that is already known to be boolean against true or false adds noise without changing the result.
This rule only reports comparisons where the non-literal side is known to be boolean. It intentionally does not report unknown values like value === true, because strict identity comparison against true is not equivalent to a truthiness check.
// β
if ((a > b) === true) {}
// β
if (a > b) {}// β
if ((a > b) === false) {}
// β
if (!(a > b)) {}// β
const active = Boolean(value) !== false;
// β
const active = Boolean(value);// β
if (value === true) {}