File tree 2 files changed +98
-0
lines changed 2 files changed +98
-0
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 : function ( node ) {
357
+ if ( ! node . parent ) {
358
+ return ;
359
+ }
360
+
361
+ var openingIndent = getNodeIndent ( node ) ;
362
+ var 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 : parserOptions
969
+ } , {
970
+ code : [
971
+ 'function App() {' ,
972
+ ' return <App>' ,
973
+ ' <Foo />' ,
974
+ ' </App>;' ,
975
+ '}'
976
+ ] . join ( '\n' ) ,
977
+ options : [ 2 ] ,
978
+ parserOptions : parserOptions
959
979
} ] ,
960
980
961
981
invalid : [ {
@@ -1056,6 +1076,50 @@ const Component = () => (
1056
1076
] . join ( '\n' ) ,
1057
1077
options : [ 2 ] ,
1058
1078
errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
1079
+ } , {
1080
+ code : [
1081
+ 'function App() {' ,
1082
+ ' return (<App>' ,
1083
+ ' <Foo />' ,
1084
+ ' </App>);' ,
1085
+ '}'
1086
+ ] . join ( '\n' ) ,
1087
+ output : [
1088
+ 'function App() {' ,
1089
+ ' return (' ,
1090
+ ' <App>' ,
1091
+ ' <Foo />' ,
1092
+ ' </App>' ,
1093
+ ' );' ,
1094
+ '}'
1095
+ ] . join ( '\n' ) ,
1096
+ options : [ 2 ] ,
1097
+ errors : [ {
1098
+ line : 5 ,
1099
+ message : 'Expected indentation of 4 space characters but found 6.'
1100
+ } ]
1101
+ } , {
1102
+ code : [
1103
+ 'function App() {' ,
1104
+ ' return (<App>' ,
1105
+ ' <Foo />' ,
1106
+ ' </App>);' ,
1107
+ '}'
1108
+ ] . join ( '\n' ) ,
1109
+ output : [
1110
+ 'function App() {' ,
1111
+ ' return (' ,
1112
+ ' <App>' ,
1113
+ ' <Foo />' ,
1114
+ ' </App>' ,
1115
+ ' );' ,
1116
+ '}'
1117
+ ] . join ( '\n' ) ,
1118
+ options : [ 2 ] ,
1119
+ errors : [ {
1120
+ line : 5 ,
1121
+ message : 'Expected indentation of 4 space characters but found 6.'
1122
+ } ]
1059
1123
} , {
1060
1124
code : [
1061
1125
'function App() {' ,
@@ -1883,5 +1947,27 @@ const Component = () => (
1883
1947
errors : [
1884
1948
{ message : 'Expected indentation of 8 space characters but found 4.' }
1885
1949
]
1950
+ } , {
1951
+ code : [
1952
+ 'function App() {' ,
1953
+ ' return (' ,
1954
+ ' <App />' ,
1955
+ ' );' ,
1956
+ '}'
1957
+ ] . join ( '\n' ) ,
1958
+ options : [ 2 ] ,
1959
+ parserOptions : parserOptions ,
1960
+ errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
1961
+ } , {
1962
+ code : [
1963
+ 'function App() {' ,
1964
+ ' return (' ,
1965
+ ' <App />' ,
1966
+ ');' ,
1967
+ '}'
1968
+ ] . join ( '\n' ) ,
1969
+ options : [ 2 ] ,
1970
+ parserOptions : parserOptions ,
1971
+ errors : [ { message : 'Expected indentation of 2 space characters but found 0.' } ]
1886
1972
} ]
1887
1973
} ) ;
You can’t perform that action at this time.
0 commit comments