[prefer-nullish-coalescing] eslint --fix
changes behavior when Logical OR's left side is optional and can be falsy
#1294
Labels
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
triage
Waiting for team members to take a look
Repro
Expected Result
no report. Fallback to
g()
whenf()
is falsy.Actual Result
@typescript-eslint/prefer-nullish-coalescing
reports the error, and also the fixed output is broken.Sample repo to reproduce the behavior: https://github.com/berlysia/typescript-eslint-nullish-coalescing-false-positive
Additional Info
This issue applies not only to
boolean
but also tonumber
andstring
.Versions
@typescript-eslint/eslint-plugin
2.9.0
@typescript-eslint/parser
2.9.0
TypeScript
3.7.2
ESLint
6.7.2
node
12.4.0
npm
6.9.0
The text was updated successfully, but these errors were encountered: