Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prop-types crashes when using props as a spread attribute #8

Closed
lo1tuma opened this issue Mar 3, 2015 · 1 comment
Closed

prop-types crashes when using props as a spread attribute #8

lo1tuma opened this issue Mar 3, 2015 · 1 comment
Assignees
Labels

Comments

@lo1tuma
Copy link

lo1tuma commented Mar 3, 2015

The following code causes the prop-types rule to crash:

render: function () {
    return (
        <AnyElement {...this.props}>
             hello world
       </AnyElement>
    );
}
TypeError: Cannot read property 'name' of undefined
    at EventEmitter.MemberExpression (my-project/node_modules/eslint-plugin-react/lib/rules/prop-types.js:39:46)
    at EventEmitter.emit (events.js:129:20)
    at Controller.controller.traverse.enter (my-project/node_modules/eslint/lib/eslint.js:683:25)
    at Controller.__execute (my-project/node_modules/eslint/node_modules/estraverse/estraverse.js:397:31)
    at Controller.traverse (my-project/node_modules/eslint/node_modules/estraverse/estraverse.js:495:28)
    at EventEmitter.module.exports.api.verify my-project/node_modules/eslint/lib/eslint.js:676:24)
    at processFile (my-project/node_modules/eslint/lib/cli-engine.js:172:23)
    at my-project/node_modules/eslint/lib/cli-engine.js:271:26
    at my-project/node_modules/eslint/lib/util/traverse.js:61:17
    at Array.forEach (native)
@lo1tuma
Copy link
Author

lo1tuma commented Mar 3, 2015

Looking at the code, it would probably also crash with the following example:

var props = this.props;

@yannickcr yannickcr added the bug label Mar 3, 2015
@yannickcr yannickcr self-assigned this Mar 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants