File tree Expand file tree Collapse file tree 2 files changed +98
-0
lines changed
Expand file tree Collapse file tree 2 files changed +98
-0
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,18 @@ module.exports = {
352352 }
353353 const parentNodeIndent = getNodeIndent ( node . parent ) ;
354354 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+ }
355367 }
356368 } ;
357369 }
Original file line number Diff line number Diff line change @@ -956,6 +956,26 @@ const Component = () => (
956956 }
957957 ` ,
958958 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
959979 } ] ,
960980
961981 invalid : [ {
@@ -1056,6 +1076,50 @@ const Component = () => (
10561076 ] . join ( '\n' ) ,
10571077 options : [ 2 ] ,
10581078 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+ } ]
10591123 } , {
10601124 code : [
10611125 'function App() {' ,
@@ -1883,5 +1947,27 @@ const Component = () => (
18831947 errors : [
18841948 { message : 'Expected indentation of 8 space characters but found 4.' }
18851949 ]
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.' } ]
18861972 } ]
18871973} ) ;
You can’t perform that action at this time.
0 commit comments