You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md
+10-2
Original file line number
Diff line number
Diff line change
@@ -46,13 +46,15 @@ type Options = [
46
46
{
47
47
ignoreConditionalTests?:boolean;
48
48
ignoreMixedLogicalExpressions?:boolean;
49
+
forceSuggestionFixer?:boolean;
49
50
},
50
51
];
51
52
52
53
const defaultOptions = [
53
54
{
54
55
ignoreConditionalTests: true,
55
-
ignoreMixedLogicalExpressions: true;
56
+
ignoreMixedLogicalExpressions: true,
57
+
forceSuggestionFixer: false,
56
58
},
57
59
];
58
60
```
@@ -129,7 +131,13 @@ a ?? (b && c) ?? d;
129
131
a?? (b&&c&&d);
130
132
```
131
133
132
-
**_NOTE:_** Errors for this specific case will be presented as suggestions, instead of fixes. This is because it is not always safe to automatically convert `||` to `??` within a mixed logical expression, as we cannot tell the intended precedence of the operator. Note that by design, `??` requires parentheses when used with `&&` or `||` in the same expression.
134
+
**_NOTE:_** Errors for this specific case will be presented as suggestions (see below), instead of fixes. This is because it is not always safe to automatically convert `||` to `??` within a mixed logical expression, as we cannot tell the intended precedence of the operator. Note that by design, `??` requires parentheses when used with `&&` or `||` in the same expression.
135
+
136
+
### forceSuggestionFixer
137
+
138
+
Setting this option to `true` will cause the rule to use ESLint's "suggested fix" mode for all fixes. _This option is provided as to aid in transitioning your codebase onto this rule_.
139
+
140
+
Suggestion fixes cannot be automatically applied via the `--fix` CLI command, but can be _manually_ chosen to be applied one at a time via an IDE or similar. This makes it safe to run autofixers on an existing codebase without worrying about potential runtime behaviour changes from this rule's fixer.
0 commit comments