File tree Expand file tree Collapse file tree
tests/fixtures/custom-jsx Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -596,6 +596,19 @@ function isSortableTemplateExpression(
596596 }
597597 }
598598
599+ if ( node . tag . type === 'CallExpression' ) {
600+ let expr = node . tag . callee
601+
602+ // If the tag is a CallExpression we should traverse all CallExpression's until we find the leading Identifier
603+ while ( expr . type === 'CallExpression' ) {
604+ expr = expr . callee
605+ }
606+
607+ if ( expr . type === 'Identifier' ) {
608+ return functions . has ( expr . name )
609+ }
610+ }
611+
599612 return false
600613}
601614
@@ -626,6 +639,19 @@ function isSortableCallExpression(
626639 }
627640 }
628641
642+ if ( node . callee . type === 'CallExpression' ) {
643+ let expr = node . callee . callee
644+
645+ // If the tag is a CallExpression we should traverse all CallExpression's until we find the leading Identifier
646+ while ( expr . type === 'CallExpression' ) {
647+ expr = expr . callee
648+ }
649+
650+ if ( expr . type === 'Identifier' ) {
651+ return functions . has ( expr . name )
652+ }
653+ }
654+
629655 return false
630656}
631657
Original file line number Diff line number Diff line change @@ -14,6 +14,14 @@ const k = tw.foo('sm:p-1 p-2');
1414const l = tw . foo . bar ( 'sm:p-1 p-2' ) ;
1515const m = no . foo ( 'sm:p-1 p-2' ) ;
1616const n = no . tw ( 'sm:p-1 p-2' ) ;
17+ const o = tw ( Foo ) `sm:p-1 p-2` ;
18+ const p = tw ( Foo ) ( Bar ) `sm:p-1 p-2` ;
19+ const q = no ( Foo ) `sm:p-1 p-2` ;
20+ const r = no . tw ( Foo ) `sm:p-1 p-2` ;
21+ const s = tw ( Foo ) ( 'sm:p-1 p-2' ) ;
22+ const t = tw ( Foo ) ( Bar ) ( 'sm:p-1 p-2' ) ;
23+ const u = no ( Foo ) ( 'sm:p-1 p-2' ) ;
24+ const v = no . tw ( Foo ) ( 'sm:p-1 p-2' ) ;
1725
1826const A = ( props ) => < div className = { props . sortMe } /> ;
1927const B = ( ) => < A sortMe = "sm:p-1 p-2" dontSort = "sm:p-1 p-2" /> ;
Original file line number Diff line number Diff line change @@ -14,6 +14,14 @@ const k = tw.foo("p-2 sm:p-1");
1414const l = tw . foo . bar ( "p-2 sm:p-1" ) ;
1515const m = no . foo ( "sm:p-1 p-2" ) ;
1616const n = no . tw ( "sm:p-1 p-2" ) ;
17+ const o = tw ( Foo ) `p-2 sm:p-1` ;
18+ const p = tw ( Foo ) ( Bar ) `p-2 sm:p-1` ;
19+ const q = no ( Foo ) `sm:p-1 p-2` ;
20+ const r = no . tw ( Foo ) `sm:p-1 p-2` ;
21+ const s = tw ( Foo ) ( "p-2 sm:p-1" ) ;
22+ const t = tw ( Foo ) ( Bar ) ( "p-2 sm:p-1" ) ;
23+ const u = no ( Foo ) ( "sm:p-1 p-2" ) ;
24+ const v = no . tw ( Foo ) ( "sm:p-1 p-2" ) ;
1725
1826const A = ( props ) => < div className = { props . sortMe } /> ;
1927const B = ( ) => < A sortMe = "p-2 sm:p-1" dontSort = "sm:p-1 p-2" /> ;
You can’t perform that action at this time.
0 commit comments