File tree 5 files changed +4
-10
lines changed
5 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -77,15 +77,9 @@ module.exports = {
77
77
return / ^ \s * { \/ \* / . test ( elementRawValue ) ;
78
78
}
79
79
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' ) ) ;
89
83
}
90
84
91
85
return {
@@ -116,8 +110,8 @@ module.exports = {
116
110
&& (
117
111
isMultilined ( element )
118
112
|| isMultilined ( findFirstNonBlockComment ( index + 2 , elements )
113
+ )
119
114
)
120
- )
121
115
) {
122
116
if ( ! isWithoutNewLine ) return ;
123
117
You can’t perform that action at this time.
0 commit comments