File tree Expand file tree Collapse file tree 6 files changed +37
-5
lines changed
test/fixtures/stateless-functional-components Expand file tree Collapse file tree 6 files changed +37
-5
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,12 @@ function isJSXElementOrReactCreateElement(path) {
55
66 path . traverse ( {
77 CallExpression ( path2 ) {
8- const {
9- callee,
10- } = path2 . node ;
8+ const callee = path2 . get ( 'callee' ) ;
119
12- if ( callee && callee . object && callee . object . name === 'React' &&
13- callee . property . name === 'createElement' ) {
10+ if (
11+ callee . matchesPattern ( 'React.createElement' ) ||
12+ callee . matchesPattern ( 'React.cloneElement' )
13+ ) {
1414 visited = true ;
1515 }
1616 } ,
Original file line number Diff line number Diff line change @@ -115,3 +115,11 @@ const Foo11 = () => (
115115Foo11 . propTypes = {
116116 foo : PropTypes . string
117117} ;
118+
119+ function Foo12 ( props ) {
120+ return React . cloneElement ( props . children ) ;
121+ }
122+
123+ Foo12 . propTypes = {
124+ foo : PropTypes . string ,
125+ } ;
Original file line number Diff line number Diff line change @@ -73,3 +73,7 @@ var Foo10 = function Foo10() {
7373var Foo11 = function Foo11 ( ) {
7474 return true && React . createElement ( "div" , null ) ;
7575} ;
76+
77+ function Foo12 ( props ) {
78+ return React . cloneElement ( props . children ) ;
79+ }
Original file line number Diff line number Diff line change @@ -65,3 +65,7 @@ const Foo10 = () => {
6565} ;
6666
6767const Foo11 = ( ) => true && < div /> ;
68+
69+ function Foo12 ( props ) {
70+ return React . cloneElement ( props . children ) ;
71+ }
Original file line number Diff line number Diff line change @@ -117,3 +117,11 @@ var Foo11 = function Foo11() {
117117process . env . NODE_ENV !== "production" ? Foo11 . propTypes = {
118118 foo : PropTypes . string
119119} : void 0 ;
120+
121+ function Foo12 ( props ) {
122+ return React . cloneElement ( props . children ) ;
123+ }
124+
125+ process . env . NODE_ENV !== "production" ? Foo12 . propTypes = {
126+ foo : PropTypes . string
127+ } : void 0 ;
Original file line number Diff line number Diff line change @@ -109,3 +109,11 @@ const Foo11 = () => true && <div />;
109109process . env . NODE_ENV !== "production" ? Foo11 . propTypes = {
110110 foo : PropTypes . string
111111} : void 0 ;
112+
113+ function Foo12 ( props ) {
114+ return React . cloneElement ( props . children ) ;
115+ }
116+
117+ process . env . NODE_ENV !== "production" ? Foo12 . propTypes = {
118+ foo : PropTypes . string
119+ } : void 0 ;
You can’t perform that action at this time.
0 commit comments