Skip to content

Commit

Permalink
docs: add missing ! (...) around comparison cases in no-unnecessary-b…
Browse files Browse the repository at this point in the history
…oolean-literal-compare fixer (#6968)

fix(docs): no-unnecessary-boolean-literal-compare fixer
  • Loading branch information
tarunrajput committed May 6, 2023
1 parent 0adc1a1 commit d4bc770
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,16 @@ if (!(someNullCondition ?? true)) {

## Fixer

| Comparison | Fixer Output | Notes |
| :----------------------------: | ------------------------------- | ----------------------------------------------------------------------------------- |
| `booleanVar === true` | `booleanVar` | |
| `booleanVar !== true` | `!booleanVar` | |
| `booleanVar === false` | `!booleanVar` | |
| `booleanVar !== false` | `booleanVar` | |
| `nullableBooleanVar === true` | `nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
| `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
| `nullableBooleanVar === false` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
| `nullableBooleanVar !== false` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
| Comparison | Fixer Output | Notes |
| :-------------------------------: | ------------------------------- | ----------------------------------------------------------------------------------- |
| `booleanVar === true` | `booleanVar` | |
| `booleanVar !== true` | `!booleanVar` | |
| `booleanVar === false` | `!booleanVar` | |
| `booleanVar !== false` | `booleanVar` | |
| `nullableBooleanVar === true` | `nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
| `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` |
| `!(nullableBooleanVar === false)` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |
| `!(nullableBooleanVar !== false)` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` |

## Not To Use It

Expand Down

0 comments on commit d4bc770

Please sign in to comment.