File tree 2 files changed +77
-3
lines changed
2 files changed +77
-3
lines changed Original file line number Diff line number Diff line change @@ -395,7 +395,19 @@ module.exports = {
395
395
checkNodesIndent ( node , parentNodeIndent + indentSize ) ;
396
396
} ,
397
397
Literal : handleLiteral ,
398
- JSXText : handleLiteral
398
+ JSXText : handleLiteral ,
399
+ ReturnStatement ( node ) {
400
+ if ( ! node . parent ) {
401
+ return ;
402
+ }
403
+
404
+ const openingIndent = getNodeIndent ( node ) ;
405
+ const closingIndent = getNodeIndent ( node , true ) ;
406
+
407
+ if ( closingIndent !== openingIndent ) {
408
+ report ( node , openingIndent , closingIndent ) ;
409
+ }
410
+ }
399
411
} ;
400
412
}
401
413
} ;
Original file line number Diff line number Diff line change @@ -997,6 +997,26 @@ const Component = () => (
997
997
'const b = `b\nb`;' ,
998
998
'}'
999
999
] . join ( '\n' )
1000
+ } , {
1001
+ code : [
1002
+ 'function App() {' ,
1003
+ ' return (' ,
1004
+ ' <App />' ,
1005
+ ' );' ,
1006
+ '}'
1007
+ ] . join ( '\n' ) ,
1008
+ options : [ 2 ] ,
1009
+ parserOptions
1010
+ } , {
1011
+ code : [
1012
+ 'function App() {' ,
1013
+ ' return <App>' ,
1014
+ ' <Foo />' ,
1015
+ ' </App>;' ,
1016
+ '}'
1017
+ ] . join ( '\n' ) ,
1018
+ options : [ 2 ] ,
1019
+ parserOptions
1000
1020
} ] ,
1001
1021
1002
1022
invalid : [ {
@@ -1102,7 +1122,10 @@ const Component = () => (
1102
1122
'}'
1103
1123
] . join ( '\n' ) ,
1104
1124
options : [ 2 ] ,
1105
- errors : [ { message : 'Expected indentation of 2 space characters but found 9.' } ]
1125
+ errors : [
1126
+ { message : 'Expected indentation of 2 space characters but found 9.' } ,
1127
+ { message : 'Expected indentation of 2 space characters but found 9.' }
1128
+ ]
1106
1129
} , {
1107
1130
code : [
1108
1131
'function App() {' ,
@@ -1119,7 +1142,10 @@ const Component = () => (
1119
1142
'}'
1120
1143
] . join ( '\n' ) ,
1121
1144
options : [ 2 ] ,
1122
- errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
1145
+ errors : [
1146
+ { message : 'Expected indentation of 2 space characters but found 4.' } ,
1147
+ { message : 'Expected indentation of 2 space characters but found 4.' }
1148
+ ]
1123
1149
} , {
1124
1150
code : [
1125
1151
'function App() {' ,
@@ -2033,5 +2059,41 @@ const Component = () => (
2033
2059
errors : [
2034
2060
{ message : 'Expected indentation of 4 space characters but found 0.' }
2035
2061
]
2062
+ } , {
2063
+ code : [
2064
+ 'function App() {' ,
2065
+ ' return (' ,
2066
+ ' <App />' ,
2067
+ ' );' ,
2068
+ '}'
2069
+ ] . join ( '\n' ) ,
2070
+ output : [
2071
+ 'function App() {' ,
2072
+ ' return (' ,
2073
+ ' <App />' ,
2074
+ ' );' ,
2075
+ '}'
2076
+ ] . join ( '\n' ) ,
2077
+ options : [ 2 ] ,
2078
+ parserOptions,
2079
+ errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
2080
+ } , {
2081
+ code : [
2082
+ 'function App() {' ,
2083
+ ' return (' ,
2084
+ ' <App />' ,
2085
+ ');' ,
2086
+ '}'
2087
+ ] . join ( '\n' ) ,
2088
+ output : [
2089
+ 'function App() {' ,
2090
+ ' return (' ,
2091
+ ' <App />' ,
2092
+ ' );' ,
2093
+ '}'
2094
+ ] . join ( '\n' ) ,
2095
+ options : [ 2 ] ,
2096
+ parserOptions,
2097
+ errors : [ { message : 'Expected indentation of 2 space characters but found 0.' } ]
2036
2098
} ]
2037
2099
} ) ;
You can’t perform that action at this time.
0 commit comments