Skip to content

Commit 88d2280

Browse files
committed
Revert deletion to prevent JSXText node catching.
1 parent fc04de6 commit 88d2280

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/rules/forbid-foreign-prop-types.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
/**
23
* @fileoverview Forbid using another component's propTypes
34
* @author Ian Christian Myers
@@ -109,7 +110,7 @@ module.exports = {
109110
&& !ast.isAssignmentLHS(node)
110111
&& !isAllowedAssignment(node)
111112
)) || (
112-
node.property.type === 'Literal'
113+
(node.property.type === 'Literal' || node.property.type === 'JSXText')
113114
&& node.property.value === 'propTypes'
114115
&& !ast.isAssignmentLHS(node)
115116
&& !isAllowedAssignment(node)
@@ -123,7 +124,7 @@ module.exports = {
123124

124125
ObjectPattern(node) {
125126
const propTypesNode = node.properties.find(
126-
(property) => property.type === 'Property' && property.key.type === 'PrivateIdentifier' && property.key.name === 'propTypes'
127+
(property) => property.type === 'Property' && property.key.type === 'Identifier' && property.key.name === 'propTypes'
127128
);
128129

129130
if (propTypesNode) {

0 commit comments

Comments
 (0)