actum / gulp-dev-stack

Actum dev stack based on gulp
MIT License
11 stars 7 forks source link

ESLint: Class method uses this #115

Closed kettanaito closed 7 years ago

kettanaito commented 7 years ago

A rule class-methods-use-this is buggy regarding React Components (as noticed by @ronaldruzicka ), and also here.

Possible solutions:

  1. Ignore the rule completely (what is a benefit of it?)
  2. Use exceptMethods option for this rule, as mentioned here, to make it ignore React methods until they are properly parsed.
vbulant commented 7 years ago

Ad 1. it tells you that class method is pointless when you don’t need this and that you can use plain function instead. Ad 2. that would help in case of componentDidMount etc. but once you need custom renderSomething() methods, it’s useless.

I like the hint that you shouldn’t overuse class methods when not needed. But writing render helpers outside of React classes seems weird to me as well.

So I don’t really know at the moment.

cc @janpanschab

vbulant commented 7 years ago

Support for exceptMethod has been added

Let’s try it and close the issue.