Closed darkwing closed 7 years ago
In TaskCluster's neutrino web preset ESLint rules, we specifically shut off class-methods-use-this
:
// Allow using class methods with static/non-instance functionality
// React lifecycle methods commonly do not use an instance context for anything
'class-methods-use-this': 'off',
Like you're seeing, React requires some lifecycle methods, which may not use the class's context, making ESLint cry. Maybe we should port the TaskCluster web preset to be our rpweb baseline preset.
I also have encountered this headache, and have valid cases for not using this
in a class method.
This has been resolved in the new rpweb neutrino preset.
So I've been using
getInitialProps
to help manage state, but I get the usualExpected 'this' to be used by class method 'getInitialProps' class-methods-use-this
error. Seems weird to havegetInitialProps
be a function outside of the class.What do you guys do here?