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

style-prop-object rule throws exception on object rest spread syntax #809

Closed
pleunv opened this issue Sep 8, 2016 · 0 comments
Closed
Labels

Comments

@pleunv
Copy link

pleunv commented Sep 8, 2016

Using v6.2.0.

The following syntax:

const RoutedButton = (props) => {
  return React.createElement(withRouter(WrappedComponent), {
    component: anchorToLink(Link),
    ...props
  });
}

is throwing the following exception:

TypeError: Cannot read property 'name' of undefined
    at c:\Projects\my-project\node_modules\eslint-plugin-react\lib\rules\style-prop-object.js:51:34
    at Array.find (native)
    at EventEmitter.CallExpression (c:\Projects\my-project\node_modules\eslint-plugin-react\lib\rules\style-prop-object.js:50:54)
    at emitOne (events.js:95:20)
    at EventEmitter.emit (events.js:182:7)
    at NodeEventGenerator.enterNode (c:\Projects\my-project\node_modules\eslint\lib\util\node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (c:\Projects\my-project\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (c:\Projects\my-project\node_modules\eslint\lib\util\comment-event-generator.js:97:23)
    at Controller.enter (c:\Projects\my-project\node_modules\eslint\lib\eslint.js:915:36)
    at Controller.__execute (c:\Projects\my-project\node_modules\eslint\node_modules\estraverse\estraverse.js:397:31)

Culprit is the rest spread syntax, removing ...props avoids the exception.

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