🌐 AI搜索 & 代理 主页
Skip to content

Bug: [@typescript-eslint/no-unused-private-class-members] Private destructed class member is defined but used #11771

@splincode

Description

@splincode

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=4.9.3&fileType=.tsx&code=MYGwhgzhAECC0G8BQ1oAcBOBLAbmALgKbQaFgAmA9gHYgCe0Y0AvNAIwDcK62eRJZKrQYAjFtABMXJN2BgQIABQBKRN1TAaEfIkYAaaGIC%2B4-AAssEaag1bKIQgDoQlAOaKwBkcq6ojSIyA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tidmUQAmtYlQBuAQ3yJaZeOOTJaAW0RKARomioMkTdA7RI4MAF8QJoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eFYDAruuGAL4g9A&tokens=false

Repro Code

class A {
  private readonly a = 1;
  private readonly b = 2;


  call() {
    const { a, b } = this;

    console.log(a, b);
  }
}

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "@typescript-eslint/no-unused-private-class-members": "error",
  },
};

tsconfig

{
  "compilerOptions": {
     "strict": true
  }
}

Expected Result

No error

Actual Result

Private class member 'a' is defined but never used. 2:20 - 2:21
Private class member 'b' is defined but never used. 3:20 - 3:21

Additional Info

eslint@9.39.1
typescript-eslint@8.47.0

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