-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Description
What rule do you want to change?
class-methods-use-this
What change do you want to make?
Generate fewer warnings
How do you think the change should be implemented?
A new option
Example code
abstract class Base {
abstract method(): void;
abstract property: () => void;
}
class Derived extends Base {
override method() {}
override property = () => {};
}
What does the rule currently do for this code?
Reports on the method
and property
for not using this
.
This is sub-optimal because some projects prefer organizing code in class extensions even when derived methods don't always need to use this
.
What will the rule do after it's changed?
If the user has enabled a new ignoreOverrideMethods
option, ignore methods and method-likes that are declared with the override
keyword. No reports would be generated for that code.
Participation
- I am willing to submit a pull request to implement this change.
Additional comments
Following #19498, this feature request corresponds to the existing typescript-eslint rule option: https://typescript-eslint.io/rules/class-methods-use-this/#ignoreoverridemethods
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLintruleRelates to ESLint's core rulesRelates to ESLint's core rules
Type
Projects
Status
Complete