File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
88### Fixed
99* [ ` jsx-curly-brace-presence ` ] : avoid warning on curlies containing quote characters ([ #3214 ] [ ] @ljharb )
1010* [ ` jsx-indent ` ] : do not report on non-jsx-returning ternaries that contain null ([ #3222 ] [ ] @ljharb )
11+ * [ ` jsx-indent ` ] : properly report on returned ternaries with jsx ([ #3222 ] [ ] @ljharb )
1112
1213[ #3222 ] : https://github.com/yannickcr/eslint-plugin-react/issues/3222
1314[ #3214 ] : https://github.com/yannickcr/eslint-plugin-react/issues/3214
Original file line number Diff line number Diff line change @@ -415,7 +415,10 @@ module.exports = {
415415 JSXText : handleLiteral ,
416416
417417 ReturnStatement ( node ) {
418- if ( ! node . parent ) {
418+ if (
419+ ! node . parent
420+ || ! jsxUtil . isJSX ( node . argument )
421+ ) {
419422 return ;
420423 }
421424
Original file line number Diff line number Diff line change @@ -1219,6 +1219,16 @@ const Component = () => (
12191219 ` ,
12201220 options : [ 99 ] ,
12211221 } ,
1222+ {
1223+ code : `
1224+ function test (foo) {
1225+ return foo != null
1226+ ? <div>foo</div>
1227+ : <div>bar</div>
1228+ }
1229+ ` ,
1230+ options : [ 2 ] ,
1231+ } ,
12221232 ] ) ,
12231233
12241234 invalid : parsers . all ( [ ] . concat (
You can’t perform that action at this time.
0 commit comments