Disable the class-methods-use-this
rule
#218
Replies: 3 comments 4 replies
-
I don't think we should disable this rule, there are some clear benefits to using normal functions over methods when the
I do agree that in some cases it's easier to reason about methods when they're part of a class. In that scenario it's fine to disable the rule for these specific methods. |
Beta Was this translation helpful? Give feedback.
-
In our current (very large) project we have only about 10 disable occurrences, which fall into two categories:
In those cases it's still useful that these methods belong as instance methods:
So in general I do think that this rule forces best practises when working with classes, and exceptions are limited. But I'm happy to be proven wrong with some code examples of cases where classes might be used differently, and this becomes a bigger issue. |
Beta Was this translation helpful? Give feedback.
-
This rule causes the second method of this class to fail because it doesn't use the word
Should this method be really outside the class since it will only be used inside it? |
Beta Was this translation helpful? Give feedback.
-
There is a proposal to disable the
class-methods-use-this
rule.Please see the documentation
Beta Was this translation helpful? Give feedback.
All reactions