Skip to content

Cannot read property 'name' of undefined TypeError at no-array-index-key.js:146:25 #1021

Closed
@lasergoat

Description

@lasergoat

This just started when I updated to:

Here's the full error output:

Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
    at /Users/daniel/Projects/node_modules/eslint-plugin-react/lib/rules/no-array-index-key.js:146:25
    at Array.forEach (native)
    at EventEmitter.CallExpression (/Users/daniel/Projects/node_modules/eslint-plugin-react/lib/rules/no-array-index-key.js:145:28)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode (/Users/daniel/Projects/node_modules/eslint/lib/util/node-event-generator.js:39:22)
    at CodePathAnalyzer.enterNode (/Users/daniel/Projects/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:607:23)
    at CommentEventGenerator.enterNode (/Users/daniel/Projects/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.enter (/Users/daniel/Projects/node_modules/eslint/lib/eslint.js:928:36)
    at Controller.__execute (/Users/daniel/Projects/node_modules/estraverse/estraverse.js:397:31)

I've tried disabling the no-array-index-key rule in my .eslintrc file but I still get the error.

Line 146 says:

if (prop.key.name !== 'key') {
  // { foo: bar }
  return;
}

@lencioni As for why prop wouldn't exist, i'm not sure. Is this the eslint-plugin-react code breaking? Or, is it my projects code somehow breaking the linter? Need more info?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions