8000 Bug: [class-methods-use-this] doesn't report on `accessor` methods with a function initializer · Issue #10790 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Bug: [class-methods-use-this] doesn't report on accessor methods with a function initializer #10790
Closed
@ronami

Description

@ronami

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.7.2&fileType=.ts&code=MYGwhgzhAEAq0G8BQ1oHo3QE4FMAOA9lgC44Am0wRuwxIAnitKRMQIzQC80AFAJRcAfIiaoMTAL4BuJEwzQAdgWLZ8RUhQBGAVxUQAFgW0gtOJmGDAcUIs2vEATF14DOw5KjFpJMiUiA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQMbwENlkBaAW0QBcALAewBNTZlESaBLVDSWgM18gAacNkgABSgE8ADilzR20yiRTx2AO0oB6fEVIUaDJizbVO6MAG0R2KImjRa0ITexZbo9gHN1TxAGFCYhQAFWoCSgBJMmkkCk0AQXVIzXteAlxEC0o4RFcIAF9XAF0RIoKgA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false

Repro Code

class T {
  // reported correctly
  test1 = () => {
    //
  };

  // not reported but should be
  accessor test2 = () => {
    //
  };
}

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "class-methods-use-this": "off",
    "@typescript-eslint/class-methods-use-this": [
      "error",
      {
        "ignoreClassesThatImplementAnInterface": true
      }
    ],
  },
};

tsconfig

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

Expected Result

I expected the accessor property to be reported, similar to the standard property.

Actual Result

The accessor property didn't get reported.

Additional Info

See #10763 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: 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

      0