Skip to content

Commit a1d9300

Browse files
committed
Clean up and code review
1 parent bf675a9 commit a1d9300

File tree

5 files changed

+554
-536
lines changed

5 files changed

+554
-536
lines changed

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

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

469-
if (prop.node && !isPropUsed(component, prop, key)) {
469+
if (prop.node && !isPropUsed(component, prop)) {
470470
context.report(
471471
prop.node,
472472
UNUSED_MESSAGE, {
@@ -523,8 +523,8 @@ module.exports = {
523523
return;
524524
}
525525

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

529529
if (node && (
530530
node.type === 'ArrowFunctionExpression'

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) {

lib/util/ast.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ function isNodeFirstInLine(context, node) {
9494
return startLine !== endLine;
9595
}
9696

97-
9897
module.exports = {
9998
findReturnStatement: findReturnStatement,
10099
getPropertyName: getPropertyName,

0 commit comments

Comments
 (0)