From 0a2c51093d39c1618efca7f5d56df5eba13b741d Mon Sep 17 00:00:00 2001 From: Yannick Croissant Date: Mon, 8 May 2017 22:12:42 +0200 Subject: [PATCH] Fix indent errors --- lib/rules/display-name.js | 3 ++- lib/rules/jsx-indent.js | 20 ++++++++++---------- lib/rules/jsx-no-literals.js | 2 +- lib/rules/no-unused-prop-types.js | 14 +++++++------- lib/rules/prop-types.js | 5 +++-- lib/rules/require-optimization.js | 8 ++++---- lib/util/Components.js | 5 +++-- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/lib/rules/display-name.js b/lib/rules/display-name.js index 8b36bfa0dd..176fc0fbf2 100644 --- a/lib/rules/display-name.js +++ b/lib/rules/display-name.js @@ -99,7 +99,8 @@ module.exports = { node.type === 'ObjectExpression' && node.parent && node.parent.parent && - node.parent.parent.type === 'AssignmentExpression' && ( + node.parent.parent.type === 'AssignmentExpression' && + ( !node.parent.parent.left.object || node.parent.parent.left.object.name !== 'module' || node.parent.parent.left.property.name !== 'exports' diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index ffc83c593f..b5d9cdff92 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -169,11 +169,11 @@ module.exports = { return startLine !== endLine; } - /** - * Check if the node is the right member of a logical expression - * @param {ASTNode} node The node to check - * @return {Boolean} true if its the case, false if not - */ + /** + * Check if the node is the right member of a logical expression + * @param {ASTNode} node The node to check + * @return {Boolean} true if its the case, false if not + */ function isRightInLogicalExp(node) { return ( node.parent && @@ -183,11 +183,11 @@ module.exports = { ); } - /** - * Check if the node is the alternate member of a conditional expression - * @param {ASTNode} node The node to check - * @return {Boolean} true if its the case, false if not - */ + /** + * Check if the node is the alternate member of a conditional expression + * @param {ASTNode} node The node to check + * @return {Boolean} true if its the case, false if not + */ function isAlternateInConditionalExp(node) { return ( node.parent && diff --git a/lib/rules/jsx-no-literals.js b/lib/rules/jsx-no-literals.js index ae3946ed18..bbb4389045 100644 --- a/lib/rules/jsx-no-literals.js +++ b/lib/rules/jsx-no-literals.js @@ -40,7 +40,7 @@ module.exports = { Literal: function(node) { if ( - !/^[\s]+$/.test(node.value) && + !/^[\s]+$/.test(node.value) && node.parent && node.parent.type !== 'JSXExpressionContainer' && node.parent.type !== 'JSXAttribute' && diff --git a/lib/rules/no-unused-prop-types.js b/lib/rules/no-unused-prop-types.js index e796632129..2b670072a0 100644 --- a/lib/rules/no-unused-prop-types.js +++ b/lib/rules/no-unused-prop-types.js @@ -596,8 +596,8 @@ module.exports = { ); // let {firstname} = props var genericDestructuring = isPropAttributeName(node) && ( - utils.getParentStatelessComponent() || - isInLifeCycleMethod(node) + utils.getParentStatelessComponent() || + isInLifeCycleMethod(node) ); if (thisDestructuring) { @@ -751,9 +751,9 @@ module.exports = { if (prop.node && !isPropUsed(component, prop)) { context.report( prop.node, - UNUSED_MESSAGE, { - name: prop.fullName - } + UNUSED_MESSAGE, { + name: prop.fullName + } ); } @@ -842,8 +842,8 @@ module.exports = { var thisDestructuring = destructuring && node.init.type === 'ThisExpression'; // let {firstname} = props var statelessDestructuring = destructuring && isPropAttributeName(node) && ( - utils.getParentStatelessComponent() || - isInLifeCycleMethod(node) + utils.getParentStatelessComponent() || + isInLifeCycleMethod(node) ); if (!thisDestructuring && !statelessDestructuring) { diff --git a/lib/rules/prop-types.js b/lib/rules/prop-types.js index 3f153edc2c..00fc1b2ba2 100644 --- a/lib/rules/prop-types.js +++ b/lib/rules/prop-types.js @@ -623,8 +623,9 @@ module.exports = { name: name, allNames: allNames, node: ( - !isDirectProp && !inConstructor() && !inComponentWillReceiveProps() ? node.parent.property : - node.property + !isDirectProp && !inConstructor() && !inComponentWillReceiveProps() ? + node.parent.property : + node.property ) }); break; diff --git a/lib/rules/require-optimization.js b/lib/rules/require-optimization.js index 7a49a259bc..5b3a78d51e 100644 --- a/lib/rules/require-optimization.js +++ b/lib/rules/require-optimization.js @@ -114,10 +114,10 @@ module.exports = { } return Boolean( - node && - node.key.name === 'mixins' && - hasPR - ); + node && + node.key.name === 'mixins' && + hasPR + ); }; /** diff --git a/lib/util/Components.js b/lib/util/Components.js index 55f49cfbf6..c7b7ac3ebc 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -294,8 +294,9 @@ function componentRule(rule, context) { node[property].alternate.type === 'JSXElement' ; var returnsConditionalJSX = - strict ? (returnsConditionalJSXConsequent && returnsConditionalJSXAlternate) : - (returnsConditionalJSXConsequent || returnsConditionalJSXAlternate); + strict ? + (returnsConditionalJSXConsequent && returnsConditionalJSXAlternate) : + (returnsConditionalJSXConsequent || returnsConditionalJSXAlternate); var returnsJSX = node[property] &&