File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,9 @@ module.exports = {
374
374
if ( ! node . parent ) {
375
375
return ;
376
376
}
377
+ if ( node . parent . type !== 'JSXElement' && node . parent . type !== 'JSXFragment' ) {
378
+ return ;
379
+ }
377
380
const parentNodeIndent = getNodeIndent ( node . parent ) ;
378
381
checkLiteralNodeIndent ( node , parentNodeIndent + indentSize ) ;
379
382
}
Original file line number Diff line number Diff line change @@ -989,6 +989,14 @@ const Component = () => (
989
989
'</App>'
990
990
] . join ( '\n' ) ,
991
991
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' )
992
1000
} ] ,
993
1001
994
1002
invalid : [ {
@@ -2003,5 +2011,20 @@ const Component = () => (
2003
2011
errors : [
2004
2012
{ message : 'Expected indentation of 1 tab character but found 2.' }
2005
2013
]
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
+ ]
2006
2029
} ]
2007
2030
} ) ;
You can’t perform that action at this time.
0 commit comments