Skip to content

Bug: [unbound-method] Does not specify which destructured method is unbound #6276

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

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&sourceType=module&showAST=ts&code=MYewdgzgLgBAbgQwDYFcCmEYF4YG8BQMRMCAFAJR4wC+ANIcQEYBcMF2AfFXQ9fvqEixcJWjEY1s8ZOggBuIA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6WJgIwHsOATWgFtE+ABbc+6KImjRu0SODABfEMqA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA

Repro Code

const values = {
    a() { },
    b: () => { },
  }

const { a, b } = values;

ESLint Config

module.exports = {
  "rules": {
    "@typescript-eslint/unbound-method": "error"
  }
}

tsconfig

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

Expected Result

Specifically a should be indicated as the offending unbound method.

Actual Result

All of { a, b } is squigglied.

Additional Info

Found when looking at tRPC's source. Thanks for the poke @KATT 😄

https://github.com/trpc/trpc/blob/269c9a2eedeae075be7f9863f870d907cb36d01d/examples/standalone-server/src/server.ts#L75-L78

Metadata

Metadata

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