Skip to content

Commit 34ce0e7

Browse files
committed
Add indentLogicalExpressions option to jsx-indent rule.
1 parent 6bb1604 commit 34ce0e7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/rules/jsx-indent.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ module.exports = {
5555
properties: {
5656
checkAttributes: {
5757
type: 'boolean'
58+
},
59+
indentLogicalExpressions: {
60+
type: 'boolean'
5861
}
5962
},
6063
additionalProperties: false
@@ -83,6 +86,7 @@ module.exports = {
8386
const indentChar = indentType === 'space' ? ' ' : '\t';
8487
const options = context.options[1] || {};
8588
const checkAttributes = options.checkAttributes || false;
89+
const indentLogicalExpressions = options.indentLogicalExpressions || false;
8690

8791
/**
8892
* Responsible for fixing the indentation issue fix
@@ -176,7 +180,8 @@ module.exports = {
176180
node.parent &&
177181
node.parent.parent &&
178182
node.parent.parent.type === 'LogicalExpression' &&
179-
node.parent.parent.right === node.parent
183+
node.parent.parent.right === node.parent &&
184+
!indentLogicalExpressions
180185
);
181186
}
182187

0 commit comments

Comments
 (0)