Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Consider using @typescript-eslint/class-methods-use-this #6

Closed
Kenneth-Sills opened this issue Aug 25, 2024 · 1 comment · Fixed by #7
Closed

Consider using @typescript-eslint/class-methods-use-this #6

Kenneth-Sills opened this issue Aug 25, 2024 · 1 comment · Fixed by #7
Assignees
Labels
enhancement New feature or request released

Comments

@Kenneth-Sills
Copy link
Owner

Kenneth-Sills commented Aug 25, 2024

Migrated from upstream issue.


There is a new @typescript-eslint/class-methods-use-this rule which makes it possible to disable the rule in the case of overrides and interface.

For example, using this (with the updated options) prevents the pesky situation where an abstract class defines some abstract methods which do NOT necessarily use this, but which need to be class methods due to the abstract class definition.


Note by maintainer:

typescript-eslint is doing their best to avoid type information being required where it's not required, but in this case saying that any class implementing an interface no longer needs any method to use this is just a wide net. I'm more amenable to ignoring methods with override.

@Kenneth-Sills Kenneth-Sills self-assigned this Aug 25, 2024
@Kenneth-Sills Kenneth-Sills added the enhancement New feature or request label Aug 25, 2024
Kenneth-Sills added a commit that referenced this issue Aug 25, 2024
By default, this does not deviate in behavior from the original rule. It does, however, provide users with additional configuration options to disable errors when this is not used in classes that implement interfaces or methods that explicitly override parent methods.

The configuration we provide has been left at the default, though, since those rules are arguably over-permissive in the pursuit of not requiring type information.

Closes #6
Copy link

🎉 This issue has been resolved in version 19.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant