Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af9ab87

Browse files
authored
docs(eslint-plugin): [no-unnecessary-boolean-literal-compare] add warning message (typescript-eslint#2832)
1 parent f714911 commit af9ab87

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ This rule ensures that you do not include unnecessary comparisons with boolean l
88
A comparison is considered unnecessary if it checks a boolean literal against any variable with just the `boolean` type.
99
A comparison is **_not_** considered unnecessary if the type is a union of booleans (`string | boolean`, `someObject | boolean`).
1010

11+
**Warning**: Do not use this rule when `strictNullChecks` is disabled.
12+
ESLint is not able to distinguish between `false` and `undefined` or `null` values.
13+
This can cause unintended code changes when using autofix.
14+
1115
**Note**: Throughout this page, only strict equality (`===` and `!==`) are
1216
used in the examples. However, the implementation of the rule does not
1317
distinguish between strict and loose equality. Any example below that uses

0 commit comments

Comments
 (0)