File tree Expand file tree Collapse file tree 2 files changed +62
-2
lines changed Expand file tree Collapse file tree 2 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,18 @@ module.exports = {
352
352
}
353
353
const parentNodeIndent = getNodeIndent ( node . parent ) ;
354
354
checkNodesIndent ( node , parentNodeIndent + indentSize ) ;
355
+ } ,
356
+ ReturnStatement ( node ) {
357
+ if ( ! node . parent ) {
358
+ return ;
359
+ }
360
+
361
+ const openingIndent = getNodeIndent ( node ) ;
362
+ const closingIndent = getNodeIndent ( node , true ) ;
363
+
364
+ if ( closingIndent !== openingIndent ) {
365
+ report ( node , openingIndent , closingIndent ) ;
366
+ }
355
367
}
356
368
} ;
357
369
}
Original file line number Diff line number Diff line change @@ -956,6 +956,26 @@ const Component = () => (
956
956
}
957
957
` ,
958
958
options : [ 2 , { indentLogicalExpressions : true } ]
959
+ } , {
960
+ code : [
961
+ 'function App() {' ,
962
+ ' return (' ,
963
+ ' <App />' ,
964
+ ' );' ,
965
+ '}'
966
+ ] . join ( '\n' ) ,
967
+ options : [ 2 ] ,
968
+ parserOptions
969
+ } , {
970
+ code : [
971
+ 'function App() {' ,
972
+ ' return <App>' ,
973
+ ' <Foo />' ,
974
+ ' </App>;' ,
975
+ '}'
976
+ ] . join ( '\n' ) ,
977
+ options : [ 2 ] ,
978
+ parserOptions
959
979
} ] ,
960
980
961
981
invalid : [ {
@@ -1038,7 +1058,10 @@ const Component = () => (
1038
1058
'}'
1039
1059
] . join ( '\n' ) ,
1040
1060
options : [ 2 ] ,
1041
- errors : [ { message : 'Expected indentation of 2 space characters but found 9.' } ]
1061
+ errors : [
1062
+ { message : 'Expected indentation of 2 space characters but found 9.' } ,
1063
+ { message : 'Expected indentation of 2 space characters but found 9.' }
1064
+ ]
1042
1065
} , {
1043
1066
code : [
1044
1067
'function App() {' ,
@@ -1055,7 +1078,10 @@ const Component = () => (
1055
1078
'}'
1056
1079
] . join ( '\n' ) ,
1057
1080
options : [ 2 ] ,
1058
- errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
1081
+ errors : [
1082
+ { message : 'Expected indentation of 2 space characters but found 4.' } ,
1083
+ { message : 'Expected indentation of 2 space characters but found 4.' }
1084
+ ]
1059
1085
} , {
1060
1086
code : [
1061
1087
'function App() {' ,
@@ -1883,5 +1909,27 @@ const Component = () => (
1883
1909
errors : [
1884
1910
{ message : 'Expected indentation of 8 space characters but found 4.' }
1885
1911
]
1912
+ } , {
1913
+ code : [
1914
+ 'function App() {' ,
1915
+ ' return (' ,
1916
+ ' <App />' ,
1917
+ ' );' ,
1918
+ '}'
1919
+ ] . join ( '\n' ) ,
1920
+ options : [ 2 ] ,
1921
+ parserOptions,
1922
+ errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
1923
+ } , {
1924
+ code : [
1925
+ 'function App() {' ,
1926
+ ' return (' ,
1927
+ ' <App />' ,
1928
+ ');' ,
1929
+ '}'
1930
+ ] . join ( '\n' ) ,
1931
+ options : [ 2 ] ,
1932
+ parserOptions,
1933
+ errors : [ { message : 'Expected indentation of 2 space characters but found 0.' } ]
1886
1934
} ]
1887
1935
} ) ;
You can’t perform that action at this time.
0 commit comments