eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

New rule: Report usages of class methods besides render returning JSX

Open jomasti opened this issue 7 years ago • 1 comments

I saw #578 and thought that the requested rule was useful. I personally don't like components that define extra render* methods that return JSX. It is a way to clean up the main render method, but the better choice is to move the logic to separate components. This rule will try to enforce that.

I wasn't sure about the rule name, so I'm open to a better name if it's offered.

Closes #578

jomasti avatar Dec 02 '17 21:12 jomasti

I like this rule also.

For reference, I have a PR that adds similar functionality to the existing prefer-stateless-function rule, but there were a few cases that I didn't manage to catch: https://github.com/yannickcr/eslint-plugin-react/pull/1313

jseminck avatar Dec 04 '17 05:12 jseminck