Skip to content

Commit cc2bdf9

Browse files
committed
added a fail safe for when there are no arguments
1 parent bb650cf commit cc2bdf9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/rules/display-name.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ module.exports = {
6565
* @returns {Boolean} True if React.forwardRef is nested inside React.memo, false if not.
6666
*/
6767
function isNestedMemo(node) {
68+
const argumentIsCallExpression = node.arguments && node.arguments[0]
69+
? node.arguments[0].type === 'CallExpression' : false;
70+
6871
return node.type === 'CallExpression'
69-
&& node.arguments[0].type === 'CallExpression'
72+
&& argumentIsCallExpression
7073
&& utils.isPragmaComponentWrapper(node);
7174
}
7275

0 commit comments

Comments
 (0)