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

Error in react/no-danger-with-children with spread operator #778

Closed
pprb opened this issue Aug 18, 2016 · 1 comment
Closed

Error in react/no-danger-with-children with spread operator #778

pprb opened this issue Aug 18, 2016 · 1 comment

Comments

@pprb
Copy link

pprb commented Aug 18, 2016

With eslint-plugin-react (6.1.1), an error occurs in this case :

import React from 'react';
import Action from './action';

var Activity = React.createClass(
    {
        render : function () {
            var cont = this.compute();
            return (
                <div>
                    <Action
                        {...cont}
                    />
                </div>
            )
        },
        compute: function () {
            return {};
        }
    }
);

export default Activity;

Error :

Cannot read property 'find' of undefined
TypeError: Cannot read property 'find' of undefined
    at findObjectProp (D:\path\node_modules\eslint-plugin-react\lib\rules\no-danger-with-children.js:28:29)
    at D:\path\node_modules\eslint-plugin-react\lib\rules\no-danger-with-children.js:46:20
    at Array.find (native)
    at findJsxProp (D:\path\node_modules\eslint-plugin-react\lib\rules\no-danger-with-children.js:40:25)
    at EventEmitter.JSXElement (D:\path\node_modules\eslint-plugin-react\lib\rules\no-danger-with-children.js:59:20)
    at emitOne (events.js:82:20)
    at EventEmitter.emit (events.js:169:7)
    at NodeEventGenerator.enterNode (D:\path\node_modules\eslint\lib\util\node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (D:\path\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (D:\path\node_modules\eslint\lib\util\comment-event-generator.js:97:23)

If cont is not the result of a function, there's no error.

@petersendidit
Copy link
Contributor

This is a duplicate of #771 which was fixed by #773 that was released in 6.1.2

@ljharb ljharb closed this as completed Aug 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants