Skip to content

Bug: [no-unused-expressions] expression with type arguments is not flagged #7748

Closed
@bradzacher

Description

@bradzacher

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.0.4&fileType=.tsx&code=MYGwhgzhAEBiD28A8AVAfNA3tAvgWAChCB6Y6CAC3gFcQATaAIwFNoBbMAJwGtmHJo1AHbUIfQgmQQALpwCWQgOZpChAIwBuQkA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tidmUQAm9AB7FoKZJQ5NUGSImjQO0SODABfEOqA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

class Foo<T> { }

// should be marked as unused
Foo<string>

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/no-unused-expressions": "error"
  }
}

tsconfig

{
  "compilerOptions": {
    "strictNullChecks": true
  }
}

Expected Result

Expected 1 error as the expression-with-type-arguments is a pure expression.

Actual Result

No errors.

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerspackage: 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