File tree Expand file tree Collapse file tree 2 files changed +76
-2
lines changed
Expand file tree Collapse file tree 2 files changed +76
-2
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 ( 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+ }
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
969+ } , {
970+ code : [
971+ 'function App() {' ,
972+ ' return <App>' ,
973+ ' <Foo />' ,
974+ ' </App>;' ,
975+ '}'
976+ ] . join ( '\n' ) ,
977+ options : [ 2 ] ,
978+ parserOptions
959979 } ] ,
960980
961981 invalid : [ {
@@ -1038,7 +1058,10 @@ const Component = () => (
10381058 '}'
10391059 ] . join ( '\n' ) ,
10401060 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+ ]
10421065 } , {
10431066 code : [
10441067 'function App() {' ,
@@ -1055,7 +1078,10 @@ const Component = () => (
10551078 '}'
10561079 ] . join ( '\n' ) ,
10571080 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+ ]
10591085 } , {
10601086 code : [
10611087 'function App() {' ,
@@ -1883,5 +1909,41 @@ const Component = () => (
18831909 errors : [
18841910 { message : 'Expected indentation of 8 space characters but found 4.' }
18851911 ]
1912+ } , {
1913+ code : [
1914+ 'function App() {' ,
1915+ ' return (' ,
1916+ ' <App />' ,
1917+ ' );' ,
1918+ '}'
1919+ ] . join ( '\n' ) ,
1920+ output : [
1921+ 'function App() {' ,
1922+ ' return (' ,
1923+ ' <App />' ,
1924+ ' );' ,
1925+ '}'
1926+ ] . join ( '\n' ) ,
1927+ options : [ 2 ] ,
1928+ parserOptions,
1929+ errors : [ { message : 'Expected indentation of 2 space characters but found 4.' } ]
1930+ } , {
1931+ code : [
1932+ 'function App() {' ,
1933+ ' return (' ,
1934+ ' <App />' ,
1935+ ');' ,
1936+ '}'
1937+ ] . join ( '\n' ) ,
1938+ output : [
1939+ 'function App() {' ,
1940+ ' return (' ,
1941+ ' <App />' ,
1942+ ' );' ,
1943+ '}'
1944+ ] . join ( '\n' ) ,
1945+ options : [ 2 ] ,
1946+ parserOptions,
1947+ errors : [ { message : 'Expected indentation of 2 space characters but found 0.' } ]
18861948 } ]
18871949} ) ;
You can’t perform that action at this time.
0 commit comments