diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index b79f724cba..2076704ad1 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -253,7 +253,7 @@ module.exports = { } function handleAttribute(node) { - if (!checkAttributes || node.value.type !== 'JSXExpressionContainer') { + if (!checkAttributes || (!node.value || node.value.type !== 'JSXExpressionContainer')) { return; } const nameIndent = getNodeIndent(node.name); diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js index 75584a32bf..43d6a80a70 100644 --- a/tests/lib/rules/jsx-indent.js +++ b/tests/lib/rules/jsx-indent.js @@ -820,6 +820,18 @@ const Component = () => ( ); `, options: ['tab', {checkAttributes: false}] + }, { + code: ` + function Foo() { + return ( + + ); + } + `, + options: [2, {checkAttributes: true}] }], invalid: [{