Skip to content

Error in prop-types rule: key is undefined  #269

Closed
@tkers

Description

@tkers

We just encountered an error in the prop-types rule while ESLinting a JSX file. I'm unable to share the full source, but will try to pinpoint the part where the rule fails exactly.

In the meantime, this is the full stack trace:

/usr/local/lib/node_modules/eslint-plugin-react/lib/rules/prop-types.js:187
return key.type === 'Identifier' ? key.name : key.value;
             ^

TypeError: Cannot read property 'type' of undefined
   at getKeyValue (/usr/local/lib/node_modules/eslint-plugin-react/lib/rules/prop-types.js:187:15)
   at markPropTypesAsUsed (/usr/local/lib/node_modules/eslint-plugin-react/lib/rules/prop-types.js:366:11)
   at EventEmitter.MemberExpression (/usr/local/lib/node_modules/eslint-plugin-react/lib/rules/prop-types.js:547:11)
   at emitOne (events.js:82:20)
   at EventEmitter.emit (events.js:169:7)
   at NodeEventGenerator.enterNode (/usr/local/lib/node_modules/eslint/lib/util/node-event-generator.js:42:22)
   at CommentEventGenerator.enterNode (/usr/local/lib/node_modules/eslint/lib/util/comment-event-generator.js:98:23)
   at Controller.controller.traverse.enter (/usr/local/lib/node_modules/eslint/lib/eslint.js:782:36)
   at Controller.__execute (/usr/local/lib/node_modules/eslint/node_modules/estraverse/estraverse.js:397:31)
   at Controller.traverse (/usr/local/lib/node_modules/eslint/node_modules/estraverse/estraverse.js:495:28)

Also, ESLint exited with code 0 in the end, which to me looks not really desirable if one of the rules fails, although I assume that's more of an issue of ESLint itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions