Bug: [prefer-optional-chain] should report case that can be converted to optional function call ?.()
#11270
Open
4 tasks done
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
Uh oh!
There was an error while loading. Please reload this page.
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.6.3&fileType=.tsx&code=CYUwxgNghgTiAEYD2A7AzgF3gMyUgXPAN4BQ88AtiBgBZLCECuKo2AliiMPAD7wAU-AJTwAvAD54ANyRtgQkgF8SJXEgB0VWvXgAyXTjybqdYMIDcQA&eslintrc=N4AhCgwIgJwVwDYFMDOUBcJiTCKABAFwE8AHVAYxgEtTCBaVBagO0IHpSYkAzJGegHs61QSwCGCehQAW41hjwB3cTBZQcAX3CagA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDAruuGAL4g9A&tokens=false
Repro Code
ESLint Config
tsconfig
Expected Result
I expect that the rule should report and suggest
foo.method?.()
.Actual Result
No report
Additional Info
This is specifically implied in the docs examples with the line
foo && foo.a && foo.a.b && foo.a.b.method && foo.a.b.method();
Relates to #9605
The text was updated successfully, but these errors were encountered: