Skip to content

Commit 50cd5a6

Browse files
committed
Clean up and code review
1 parent 5b5ebfa commit 50cd5a6

File tree

4 files changed

+554
-535
lines changed

4 files changed

+554
-535
lines changed

lib/rules/no-unused-prop-types.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ module.exports = {
467467
return;
468468
}
469469

470-
if (prop.node && !isPropUsed(component, prop, key)) {
470+
if (prop.node && !isPropUsed(component, prop)) {
471471
context.report(
472472
prop.node,
473473
UNUSED_MESSAGE, {
@@ -524,8 +524,8 @@ module.exports = {
524524
return;
525525
}
526526

527-
Object.values(propTypes).forEach(propType => {
528-
const node = propType.node;
527+
Object.keys(propTypes).forEach(key => {
528+
const node = propTypes[key].node;
529529

530530
if (astUtil.isFunctionLikeExpression(node)) {
531531
markPropTypesAsUsed(node);

lib/rules/prop-types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ module.exports = {
187187
// If it's a computed property, we can't make any further analysis, but is valid
188188
return key === '__COMPUTED_PROP__';
189189
}
190-
191190
if (typeof propType === 'object' && !propType.type) {
192191
return true;
193192
}

lib/util/Components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ function componentRule(rule, context) {
695695
// Update the provided rule instructions to add the component detection
696696
const ruleInstructions = rule(context, components, utils);
697697
const updatedRuleInstructions = util._extend({}, ruleInstructions);
698-
const propTypesInstructions = propTypes.instructions(context, components, utils);
698+
const propTypesInstructions = propTypes(context, components, utils);
699699
const allKeys = new Set(Object.keys(detectionInstructions).concat(Object.keys(propTypesInstructions)));
700700
allKeys.forEach(instruction => {
701701
updatedRuleInstructions[instruction] = function(node) {

0 commit comments

Comments
 (0)