File tree Expand file tree Collapse file tree 5 files changed +4
-10
lines changed Expand file tree Collapse file tree 5 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -77,15 +77,9 @@ module.exports = {
7777 return / ^ \s * { \/ \* / . test ( elementRawValue ) ;
7878 }
7979
80- function findFirstNonBlockComment ( index , elements ) {
81- if ( index >= elements . length ) return ;
82-
83- const element = elements [ index ] ;
84- const isElementJSX = element . type === 'JSXElement' || element . type === 'JSXExpressionContainer' ;
85-
86- if ( ! isBlockCommentInCurlyBraces ( element ) && isElementJSX ) return element ;
87-
88- return findFirstNonBlockComment ( index + 1 , elements ) ;
80+ function findFirstNonBlockComment ( startIndex , elements ) {
81+ const remainingElements = elements . slice ( startIndex ) ;
82+ return remainingElements . find ( ( element ) => ! isBlockCommentInCurlyBraces ( element ) && ( element . type === 'JSXElement' || element . type === 'JSXExpressionContainer' ) ) ;
8983 }
9084
9185 return {
@@ -116,8 +110,8 @@ module.exports = {
116110 && (
117111 isMultilined ( element )
118112 || isMultilined ( findFirstNonBlockComment ( index + 2 , elements )
113+ )
119114 )
120- )
121115 ) {
122116 if ( ! isWithoutNewLine ) return ;
123117
You can’t perform that action at this time.
0 commit comments