Skip to content

Commit

Permalink
Clean up and code review
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzherdev committed Aug 5, 2018
1 parent bf675a9 commit 2cfaaba
Show file tree
Hide file tree
Showing 4 changed files with 554 additions and 535 deletions.
6 changes: 3 additions & 3 deletions lib/rules/no-unused-prop-types.js
Expand Up @@ -466,7 +466,7 @@ module.exports = {
return;
}

if (prop.node && !isPropUsed(component, prop, key)) {
if (prop.node && !isPropUsed(component, prop)) {
context.report(
prop.node,
UNUSED_MESSAGE, {
Expand Down Expand Up @@ -523,8 +523,8 @@ module.exports = {
return;
}

Object.values(propTypes).forEach(propType => {
const node = propType.node;
Object.keys(propTypes).forEach(key => {
const node = propTypes[key].node;

if (node && (
node.type === 'ArrowFunctionExpression'
Expand Down
1 change: 0 additions & 1 deletion lib/rules/prop-types.js
Expand Up @@ -187,7 +187,6 @@ module.exports = {
// If it's a computed property, we can't make any further analysis, but is valid
return key === '__COMPUTED_PROP__';
}

if (typeof propType === 'object' && !propType.type) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/util/Components.js
Expand Up @@ -695,7 +695,7 @@ function componentRule(rule, context) {
// Update the provided rule instructions to add the component detection
const ruleInstructions = rule(context, components, utils);
const updatedRuleInstructions = util._extend({}, ruleInstructions);
const propTypesInstructions = propTypes.instructions(context, components, utils);
const propTypesInstructions = propTypes(context, components, utils);
const allKeys = new Set(Object.keys(detectionInstructions).concat(Object.keys(propTypesInstructions)));
allKeys.forEach(instruction => {
updatedRuleInstructions[instruction] = function(node) {
Expand Down

0 comments on commit 2cfaaba

Please sign in to comment.