We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3008e85 commit e68461fCopy full SHA for e68461f
lib/rules/forbid-foreign-prop-types.js
@@ -52,6 +52,18 @@ module.exports = {
52
return null;
53
}
54
55
+ function findParentClassProperty(node) {
56
+ let parent = node.parent;
57
+
58
+ while (parent && parent.type !== 'Program') {
59
+ if (parent.type === 'ClassProperty') {
60
+ return parent;
61
+ }
62
+ parent = parent.parent;
63
64
+ return null;
65
66
67
function isAllowedAssignment(node) {
68
if (!allowInPropTypes) {
69
return false;
@@ -67,6 +79,16 @@ module.exports = {
79
) {
80
return true;
81
82
83
+ const classProperty = findParentClassProperty(node);
84
85
+ if (
86
+ classProperty &&
87
+ classProperty.key &&
88
+ classProperty.key.name === 'propTypes'
89
+ ) {
90
+ return true;
91
70
92
71
93
72
94
0 commit comments