diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js
index 62452be43b..dc4d582a36 100644
--- a/lib/rules/jsx-indent.js
+++ b/lib/rules/jsx-indent.js
@@ -176,6 +176,13 @@ module.exports = {
}
var peerElementIndent = getNodeIndent(node.parent.openingElement);
checkNodesIndent(node, peerElementIndent);
+ },
+ JSXExpressionContainer: function(node) {
+ if (!node.parent) {
+ return;
+ }
+ var parentNodeIndent = getNodeIndent(node.parent);
+ checkNodesIndent(node, parentNodeIndent + indentSize);
}
};
diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js
index d2f7892f96..3eb7ba9d7f 100644
--- a/tests/lib/rules/jsx-indent.js
+++ b/tests/lib/rules/jsx-indent.js
@@ -162,5 +162,56 @@ ruleTester.run('jsx-indent', rule, {
options: [2],
parserOptions: parserOptions,
errors: [{message: 'Expected indentation of 4 space characters but found 0.'}]
+ }, {
+ code: [
+ '',
+ ' {test}',
+ ''
+ ].join('\n'),
+ parserOptions: parserOptions,
+ errors: [
+ {message: 'Expected indentation of 4 space characters but found 3.'}
+ ]
+ }, {
+ code: [
+ '',
+ ' {options.map((option, index) => (',
+ ' ',
+ ' ))}',
+ ''
+ ].join('\n'),
+ parserOptions: parserOptions,
+ errors: [
+ {message: 'Expected indentation of 12 space characters but found 11.'}
+ ]
+ }, {
+ code: [
+ '',
+ '{test}',
+ ''
+ ].join('\n'),
+ parserOptions: parserOptions,
+ options: ['tab'],
+ errors: [
+ {message: 'Expected indentation of 1 tab character but found 0.'}
+ ]
+ }, {
+ code: [
+ '',
+ '\t{options.map((option, index) => (',
+ '\t\t',
+ '\t))}',
+ ''
+ ].join('\n'),
+ parserOptions: parserOptions,
+ options: ['tab'],
+ errors: [
+ {message: 'Expected indentation of 3 tab characters but found 2.'}
+ ]
}]
});
+