diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index f6ed3ac5a1..791d8cb9d0 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -284,7 +284,7 @@ module.exports = { prevToken = prevToken.type === 'JSXExpressionContainer' ? prevToken.expression : prevToken; var parentElementIndent = getNodeIndent(prevToken); - if (prevToken.type === 'JSXElement') { + if (prevToken.type === 'JSXElement' && (!prevToken.parent || prevToken.parent.type !== 'LogicalExpression')) { parentElementIndent = getOpeningElementIndent(prevToken.openingElement); } diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js index 960a1009c0..a06b58f8e6 100644 --- a/tests/lib/rules/jsx-indent.js +++ b/tests/lib/rules/jsx-indent.js @@ -459,6 +459,22 @@ ruleTester.run('jsx-indent', rule, { ].join('\n'), options: [2], parserOptions: parserOptions + }, { + code: [ + 'function foo() {', + ' return (', + '