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

[no-unused-expressions] False positive with optional chaining #1138

Closed
ipcjs opened this issue Oct 25, 2019 · 3 comments · Fixed by #1175 or kaliber5/k5-ember-boilerplate#3
Closed
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@ipcjs
Copy link

ipcjs commented Oct 25, 2019

Repro

{
  "rules": {
    "no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true }],
  }
}
class Test {
  test() {
  }
}
declare const t: Test | undefined
t?.test()

Expected Result

Actual Result

D:\test\test.ts
  6:1  error  Expected an assignment or function call and instead saw an expression  no-unused-expressions

Versions

package version
@typescript-eslint/eslint-plugin 2.5.0
@typescript-eslint/parser 2.5.0
TypeScript 3.7.0-dev.20191021
ESLint 5.16.0
node v10.15.3
npm 6.10.1
@ipcjs ipcjs added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Oct 25, 2019
@bradzacher bradzacher added bug Something isn't working scope analyser Issues that are caused by bugs/incomplete cases in the scope analyser and removed triage Waiting for maintainers to take a look labels Oct 25, 2019
@bradzacher
Copy link
Member

Same root cause as #1090 et al

@hronro
Copy link

hronro commented Dec 18, 2019

Is this problem solved?
I'm still facing this problem.

Versions:

eslint: v6.7.2
@typescript-eslint/eslint-plugin: v2.12.0
@typescript-eslint/parser: v2.12.0
typescript: v3.7.3

@bradzacher
Copy link
Member

please don't comment on closed issues.
open a new issue and fill in all of the details with a repro.

@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Dec 18, 2019
lolmaus pushed a commit to kaliber5/k5-ember-boilerplate that referenced this issue Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
3 participants