File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,15 @@ export class Button extends React.Component {
21
21
} ;
22
22
}
23
23
}
24
+
25
+ export function foo ( ) {
26
+ return [ ] . join ( ) ;
27
+ }
28
+
29
+ export function chained ( ) {
30
+ return foo . bar ( ) . join ( ) ;
31
+ }
32
+
33
+ export function templateLiteral ( ) {
34
+ return `foo bar` . split ( ' ' ) ;
35
+ }
Original file line number Diff line number Diff line change @@ -28,6 +28,16 @@ const validPossibleStatelessComponentTypes = [
28
28
'ArrowFunctionExpression' ,
29
29
] ;
30
30
31
+ function isValidCalleeType ( type ) {
32
+ return [
33
+ 'Identifier' ,
34
+ 'CallExpression' ,
35
+ 'ArrayExpression' ,
36
+ 'TemplateLiteral' ,
37
+ 'Literal'
38
+ ] . indexOf ( type ) < 0 ;
39
+ }
40
+
31
41
function isJSXElementOrReactCreateElement ( path ) {
32
42
return (
33
43
path . node . type === 'JSXElement' ||
@@ -94,7 +104,7 @@ function returnsJSXElementOrReactCreateElementCall(path) {
94
104
resolvedValue = resolveToValue ( calleeValue . get ( 'object' ) ) ;
95
105
}
96
106
else {
97
- while ( calleeValue . get ( 'object' ) . node . type !== 'Identifier' ) {
107
+ while ( isValidCalleeType ( calleeValue . get ( 'object' ) . node . type ) ) {
98
108
calleeValue = calleeValue . get ( 'object' ) ;
99
109
namesToResolve . unshift ( calleeValue . get ( 'property' ) ) ;
100
110
}
You can’t perform that action at this time.
0 commit comments