Skip to content

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

Closed
kaliber5/k5-ember-boilerplate
#3
@ipcjs

Description

@ipcjs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: 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