menu

no-boolean-literal-compare

Disallow comparing boolean values to boolean literals

For a boolean operand, comparison with true returns the operand and comparison with false returns its negation. Instead, you SHOULD use the boolean value directly or negate it.

Reported

1function active(value: boolean): boolean {2    return value === true;3}

Accepted

1function active(value: boolean): boolean {2    return value;3}