Skip to content

Commit

Permalink
[Fix]: utils/Components correct spelling and delete unUsed code
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhoney1 committed Jul 27, 2021
1 parent d0b5196 commit f16c64e
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions lib/util/Components.js
Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -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);
},
Expand Down Expand Up @@ -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,

Expand Down

0 comments on commit f16c64e

Please sign in to comment.