Skip to content

[method-signature-style] Shouldn't affect methods that use thisΒ #1991

Open
@fregante

Description

@fregante

Repro

{
  "rules": {
    "@typescript-eslint/method-signature-style": ["error"]
  }
}
interface Foo {
	cloneThis(): this; // ❌ reported
	cloneThis: () => this; //  πŸ€” fixed to this
}

Expected Result

Methods should not be affected, this should not be autofixed:

interface Foo {
	cloneThis(): this;
}

Actual Result

That type is changed to an arrow function, which doesn't have this

interface Foo {
	cloneThis: () => this; //  Fixed to this, broken
}

Additional Info

It causes errors elsewhere in the code

Versions

package version
@typescript-eslint/eslint-plugin 2.27.0
@typescript-eslint/parser 2.27.0
TypeScript 3.8.3
ESLint 6.8.0
node 13.8.0
npm 6.13.6

Metadata

Metadata

Assignees

Labels

accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions