New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[prefer-nullish-coalescing] eslint --fix outputs broken code #1290
Labels
bug
Something isn't working
good first issue
Good for newcomers
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Comments
susisu
added
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
triage
Waiting for maintainers to take a look
labels
Dec 1, 2019
bradzacher
added
bug
Something isn't working
good first issue
Good for newcomers
and removed
triage
Waiting for maintainers to take a look
labels
Dec 1, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 11, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 11, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 11, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 11, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 11, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 12, 2019
dimabory
added a commit
to dimabory/typescript-eslint
that referenced
this issue
Dec 12, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
bug
Something isn't working
good first issue
Good for newcomers
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Repro
.eslintrc.json
tsconfig.json
src/index.ts
Expected Result
The last line should be fixed like this:
Here parentheses are required because nullish coalescing operators and logical operators cannot be mixed.
Since logical operator
||
is left-associative, it is natural to add parentheses in left-to-right manner.Actual Result
eslint --fix
outputs this:This is not a valid syntax and we get the following error.
Additional Info
Versions
@typescript-eslint/eslint-plugin
2.9.0
@typescript-eslint/parser
2.9.0
TypeScript
3.7.2
ESLint
6.7.2
node
12.13.0
npm
6.13.1
The text was updated successfully, but these errors were encountered: