Skip to content

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

Closed
@garyking

Description

@garyking

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions