Skip to content
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-optional-chain] Only checks the first occurrence in conditional #1461

Closed
garyking opened this issue Jan 15, 2020 · 2 comments · Fixed by #6397
Closed

[prefer-optional-chain] Only checks the first occurrence in conditional #1461

garyking opened this issue Jan 15, 2020 · 2 comments · Fixed by #6397
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@garyking
Copy link
Contributor

garyking commented Jan 15, 2020

Repro

{
  "rules": {
    "@typescript-eslint/prefer-optional-chain": "warn"
  }
}
foo && foo.a && bar && bar.a

Expected Result

foo?.a && bar?.a

Actual Result

foo?.a && bar && bar.a

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.16.0
@typescript-eslint/parser 2.16.0
TypeScript 3.7.4
ESLint 6.8.0
node 13.5.0
npm 6.13.4
@garyking garyking added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jan 15, 2020
@bradzacher
Copy link
Member

Related to #1438 - the selectors don't match everything. They're too relaxed atm.

@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Jan 15, 2020
@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
@Josh-Cena
Copy link
Member

Fixed by #6397

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants