Javascript: Expected 'this' to be used by class method 'render' class-methods-use-this

Created on 15 Sep 2016  路  2Comments  路  Source: airbnb/javascript

This rule was just updated to support exception array. It should be supported with the next release of eslint:

https://github.com/eslint/eslint/pull/7120

All React lifecycle methods should be inside exception array so airbnb should update this rule once new version gets released. This rule expects me to have render method as static which is not possible. React expects all methods to be instance methods and making them static breaks React and disables it from finding render method. This is also valid for all other methods. Right now I have to exclude this rule in every method that doesn't use this keyword.

needs eslint rule changaddition

Most helpful comment

This is now resolved in v12.0.0 (in 39d7c73ef10f0c2c45681722159f5a8897b99cf9). All of the React lifecycle and instance methods are now exempted.

All 2 comments

Yes, I'm aware - it was my PR and issue.

When our configs are updated with that version of eslint, we'll be exempting all the React lifecycle methods.

This is now resolved in v12.0.0 (in 39d7c73ef10f0c2c45681722159f5a8897b99cf9). All of the React lifecycle and instance methods are now exempted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielfttorres picture danielfttorres  路  3Comments

kozhevnikov picture kozhevnikov  路  3Comments

mismith picture mismith  路  3Comments

brendanvinson picture brendanvinson  路  4Comments

ar
mbifulco picture mbifulco  路  3Comments