File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -42,20 +42,24 @@ module.exports = {
4242 } ) ;
4343 }
4444
45- function getValidation ( node ) {
45+ function getParentIgnoringBinaryExpressions ( node ) {
4646 let current = node ;
4747 while ( current . parent . type === 'BinaryExpression' ) {
4848 current = current . parent ;
4949 }
50+ return current . parent ;
51+ }
52+
53+ function getValidation ( node ) {
54+ const parent = getParentIgnoringBinaryExpressions ( node ) ;
5055 const standard = ! / ^ [ \s ] + $ / . test ( node . value ) &&
5156 typeof node . value === 'string' &&
52- current . parent &&
53- current . parent . type . indexOf ( 'JSX' ) !== - 1 &&
54- current . parent . type !== 'JSXAttribute' ;
57+ parent . type . indexOf ( 'JSX' ) !== - 1 &&
58+ parent . type !== 'JSXAttribute' ;
5559 if ( isNoStrings ) {
5660 return standard ;
5761 }
58- return standard && node . parent . type !== 'JSXExpressionContainer' ;
62+ return standard && parent . type !== 'JSXExpressionContainer' ;
5963 }
6064
6165 // --------------------------------------------------------------------------
@@ -71,7 +75,8 @@ module.exports = {
7175 } ,
7276
7377 TemplateLiteral : function ( node ) {
74- if ( isNoStrings && node . parent . type === 'JSXExpressionContainer' ) {
78+ const parent = getParentIgnoringBinaryExpressions ( node ) ;
79+ if ( isNoStrings && parent . type === 'JSXExpressionContainer' ) {
7580 reportLiteralNode ( node ) ;
7681 }
7782 }
You can’t perform that action at this time.
0 commit comments