File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,9 @@ module.exports = {
374374 if ( ! node . parent ) {
375375 return ;
376376 }
377+ if ( node . parent . type !== 'JSXElement' && node . parent . type !== 'JSXFragment' ) {
378+ return ;
379+ }
377380 const parentNodeIndent = getNodeIndent ( node . parent ) ;
378381 checkLiteralNodeIndent ( node , parentNodeIndent + indentSize ) ;
379382 }
Original file line number Diff line number Diff line change @@ -989,6 +989,14 @@ const Component = () => (
989989 '</App>'
990990 ] . join ( '\n' ) ,
991991 options : [ 'tab' ]
992+ } , {
993+ // don't check literals not within JSX. See #2563
994+ code : [
995+ 'function foo() {' ,
996+ 'const a = `aa`;' ,
997+ 'const b = `b\nb`;' ,
998+ '}'
999+ ] . join ( '\n' )
9921000 } ] ,
9931001
9941002 invalid : [ {
@@ -2003,5 +2011,20 @@ const Component = () => (
20032011 errors : [
20042012 { message : 'Expected indentation of 1 tab character but found 2.' }
20052013 ]
2014+ } , {
2015+ code : [
2016+ '<>' ,
2017+ 'aaa' ,
2018+ '</>'
2019+ ] . join ( '\n' ) ,
2020+ parser : parsers . BABEL_ESLINT ,
2021+ output : [
2022+ '<>' ,
2023+ ' aaa' ,
2024+ '</>'
2025+ ] . join ( '\n' ) ,
2026+ errors : [
2027+ { message : 'Expected indentation of 4 space characters but found 0.' }
2028+ ]
20062029 } ]
20072030} ) ;
You can’t perform that action at this time.
0 commit comments