Skip to content

Commit

Permalink
Add indentLogicalExpressions option to jsx-indent rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnsk committed Apr 3, 2019
1 parent 6bb1604 commit 34ce0e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rules/jsx-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ module.exports = {
properties: {
checkAttributes: {
type: 'boolean'
},
indentLogicalExpressions: {
type: 'boolean'
}
},
additionalProperties: false
Expand Down Expand Up @@ -83,6 +86,7 @@ module.exports = {
const indentChar = indentType === 'space' ? ' ' : '\t';
const options = context.options[1] || {};
const checkAttributes = options.checkAttributes || false;
const indentLogicalExpressions = options.indentLogicalExpressions || false;

/**
* Responsible for fixing the indentation issue fix
Expand Down Expand Up @@ -176,7 +180,8 @@ module.exports = {
node.parent &&
node.parent.parent &&
node.parent.parent.type === 'LogicalExpression' &&
node.parent.parent.right === node.parent
node.parent.parent.right === node.parent &&
!indentLogicalExpressions
);
}

Expand Down

0 comments on commit 34ce0e7

Please sign in to comment.