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

no-danger-with-children exception with spread props #767

Closed
btmills opened this issue Aug 15, 2016 · 5 comments
Closed

no-danger-with-children exception with spread props #767

btmills opened this issue Aug 15, 2016 · 5 comments
Labels

Comments

@btmills
Copy link

btmills commented Aug 15, 2016

// .eslintrc.js
module.exports = {
    "root": true,

    "parserOptions": {
        "ecmaVersion": 6,
        "ecmaFeatures": {
            "experimentalObjectRestSpread": true,
            "jsx": true
        }
    },

    "plugins": ["react"],

    "rules": {
        "react/no-danger-with-children": "error"
    }
};
// pass.jsx
<div />
// fail.jsx
<div {...props} />
$ npm ls --depth=0
~/test
├── eslint@3.3.0
└── eslint-plugin-react@6.1.0

$ node_modules/.bin/eslint pass.jsx
$ node_modules/.bin/eslint fail.jsx
Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
    at ~/test/node_modules/eslint-plugin-react/lib/rules/no-danger-with-children.js:29:34
    at Array.find (native)
    at EventEmitter.JSXElement (~/test/node_modules/eslint-plugin-react/lib/rules/no-danger-with-children.js:28:41)
    at emitOne (events.js:96:13)
    at EventEmitter.emit (events.js:188:7)
    at NodeEventGenerator.enterNode (~/test/node_modules/eslint/lib/util/node-event-generator.js:40:22)
    at CodePathAnalyzer.enterNode (~/test/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at CommentEventGenerator.enterNode (~/test/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
    at Controller.traverser.traverse.enter (~/test/node_modules/eslint/lib/eslint.js:895:36)
    at Controller.__execute (~/test/node_modules/estraverse/estraverse.js:397:31)
@lencioni lencioni added the bug label Aug 15, 2016
@petersendidit
Copy link
Contributor

I can work on a fix.

btmills added a commit to btmills/eslint-config-btmills that referenced this issue Aug 15, 2016
petersendidit added a commit to petersendidit/eslint-plugin-react that referenced this issue Aug 15, 2016
petersendidit added a commit to petersendidit/eslint-plugin-react that referenced this issue Aug 15, 2016
@cristian-sima
Copy link

Did you commit your changes?

@cristian-sima
Copy link

I am asking this, because it is a blocking script which prevents me from commiting the code

@petersendidit
Copy link
Contributor

There is a pull request for the fix that hasn't been merged yet.

@yannickcr
Copy link
Member

Thanks @petersendidit. The PR was merged, a bugfix release will be published tonight.

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

5 participants