Skip to content

Commit

Permalink
docs: fix incorrect prefer-nullish-coercing documentation (#7408)
Browse files Browse the repository at this point in the history
Fix misleading documentation
  • Loading branch information
samchungy committed Aug 5, 2023
1 parent 9e1d2d2 commit 8b17a25
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This rule will not work as expected if [`strictNullChecks`](https://www.typescri

### `ignoreTernaryTests`

Setting this option to `true` (the default) will cause the rule to ignore any ternary expressions that could be simplified by using the nullish coalescing operator.
Setting this option to `true` will cause the rule to ignore any ternary expressions that could be simplified by using the nullish coalescing operator. This is set to `false` by default.

Incorrect code for `ignoreTernaryTests: false`, and correct code for `ignoreTernaryTests: true`:

Expand Down Expand Up @@ -62,7 +62,7 @@ foo ?? 'a string';

### `ignoreConditionalTests`

Setting this option to `true` (the default) will cause the rule to ignore any cases that are located within a conditional test.
Setting this option to `true` will cause the rule to ignore any cases that are located within a conditional test. This is set to `false` by default.

Generally expressions within conditional tests intentionally use the falsy fallthrough behavior of the logical or operator, meaning that fixing the operator to the nullish coalesce operator could cause bugs.

Expand Down Expand Up @@ -104,7 +104,7 @@ a ?? b ? true : false;

### `ignoreMixedLogicalExpressions`

Setting this option to `true` (the default) will cause the rule to ignore any logical or expressions that are part of a mixed logical expression (with `&&`).
Setting this option to `true` will cause the rule to ignore any logical or expressions that are part of a mixed logical expression (with `&&`). This is set to `false` by default.

Generally expressions within mixed logical expressions intentionally use the falsy fallthrough behavior of the logical or operator, meaning that fixing the operator to the nullish coalesce operator could cause bugs.

Expand Down

0 comments on commit 8b17a25

Please sign in to comment.