diff --git a/lib/util/Components.js b/lib/util/Components.js index ef25709557..6b886f03be 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -401,8 +401,8 @@ function componentRule(rule, context) { } const propertyNames = ['forwardRef', 'memo']; const calleeObject = node.callee.object; - if (calleeObject) { - return arrayIncludes(propertyNames, node.callee.property.name) && node.callee.object.name === pragma; + if (calleeObject && node.callee.property) { + return arrayIncludes(propertyNames, node.callee.property.name) && calleeObject.name === pragma; } return arrayIncludes(propertyNames, node.callee.name) && this.isDestructuredFromPragmaImport(node.callee.name); }, diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index 41c2a42677..ab1785930f 100644 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -2296,6 +2296,13 @@ ruleTester.run('prop-types', rule, { export const Unconnected = Foo; export default connect(Foo); ` + }, { + code: ` + const a = {}; + function fn1() {} + const b = a::fn1(); + `, + parser: 'babel-eslint' } ],