From f16c64e36ec3bbbbc0db5f3697aae184b14a6828 Mon Sep 17 00:00:00 2001 From: ohhoney1 <1269075501@qq.com> Date: Tue, 27 Jul 2021 20:25:59 +0800 Subject: [PATCH] [Fix]: `utils/Components` correct spelling and delete unUsed code --- lib/util/Components.js | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/lib/util/Components.js b/lib/util/Components.js index 0ba329dae5..8b21d940ae 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -38,8 +38,8 @@ function usedPropTypesAreEquivalent(propA, propB) { function mergeUsedPropTypes(propsList, newPropsList) { const propsToAdd = []; newPropsList.forEach((newProp) => { - const newPropisAlreadyInTheList = propsList.some((prop) => usedPropTypesAreEquivalent(prop, newProp)); - if (!newPropisAlreadyInTheList) { + const newPropsAlreadyInTheList = propsList.some((prop) => usedPropTypesAreEquivalent(prop, newProp)); + if (!newPropsAlreadyInTheList) { propsToAdd.push(newProp); } }); @@ -412,30 +412,6 @@ function componentRule(rule, context) { return node.type === 'MemberExpression' && node.object.type === 'ThisExpression' && node.property.name === 'state'; }, - getReturnPropertyAndNode(ASTnode) { - let property; - let node = ASTnode; - switch (node.type) { - case 'ReturnStatement': - property = 'argument'; - break; - case 'ArrowFunctionExpression': - property = 'body'; - if (node[property] && node[property].type === 'BlockStatement') { - node = utils.findReturnStatement(node); - property = 'argument'; - } - break; - default: - node = utils.findReturnStatement(node); - property = 'argument'; - } - return { - node, - property - }; - }, - isReturningJSX(ASTNode, strict) { return jsxUtil.isReturningJSX(this.isCreateElement.bind(this), ASTNode, strict, true); }, @@ -552,9 +528,9 @@ function componentRule(rule, context) { }, /** - * Find a return statment in the current node + * Find a return statement in the current node * - * @param {ASTNode} ASTnode The AST node being checked + * @param {ASTNode} node The AST node being checked */ findReturnStatement: astUtil.findReturnStatement,