You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And because of that some rules are ignored (e.g. sort-comp rule).
So I propose to check when there is no render() method inside component if the mixins prop is declared or not.
For ES5 classes we can simplify the detection and just rely on the React.createClass presence, it would solve your problem.
But for ES6 classes it is more difficult since there is no real difference between a standard ES6 class and a React component, that why currently we just search for a class with a render method that return some JSX (or null).
So I'm running into this issue in a slightly different variant. I'm actually looking at running sort-comp on the output from CJSX, which gives me a render which looks like
Activity
yannickcr commentedon Jul 31, 2015
For ES5 classes we can simplify the detection and just rely on the React.createClass presence, it would solve your problem.
But for ES6 classes it is more difficult since there is no real difference between a standard ES6 class and a React component, that why currently we just search for a class with a render method that return some JSX (or null).
jbrumwell commentedon Aug 12, 2015
Just ran into this same problem, we have a
render
method declared but it doesn't return aJSXElement
directly so it gets ignored (sort-comp rule);something along the lines of;
epmatsw commentedon Sep 3, 2015
So I'm running into this issue in a slightly different variant. I'm actually looking at running
sort-comp
on the output from CJSX, which gives me a render which looks likeBecause the render contains compiled JSX rather than actual JSX, it gets skipped.
lencioni commentedon Jul 24, 2016
It might be useful to check out react-codemod's ReactUtils to see the methods they use for this kind of thing.
return
#1076ljharb commentedon Jan 27, 2018
I'm going to close this; in general, component detection needs some work, but there's been many updates since this was filed.
New issues with concrete and actionable improvements are welcome!