version: 6.3.0
Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
at /Users/myabc/git/myproj/node_modules/eslint-plugin-react/lib/rules/no-children-prop.js:57:26
at Array.find (native)
at EventEmitter.CallExpression (/Users/myabc/git/myproj/node_modules/eslint-plugin-react/lib/rules/no-children-prop.js:56:34)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:188:7)
at NodeEventGenerator.enterNode (/Users/myabc/git/myproj/node_modules/eslint/lib/util/node-event-generator.js:40:22)
at CodePathAnalyzer.enterNode (/Users/myabc/git/myproj/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
at CommentEventGenerator.enterNode (/Users/myabc/git/myproj/node_modules/eslint/lib/util/comment-event-generator.js:97:23)
at Controller.enter (/Users/myabc/git/myproj/node_modules/eslint/lib/eslint.js:918:36)
at Controller.__execute (/Users/myabc/git/myproj/node_modules/eslint/node_modules/estraverse/estraverse.js:397:31)
Error code:
export class CustomLayout extends React.Component {
static propTypes = {
children: React.PropTypes.node,
elementType: React.PropTypes.oneOf(['ul', 'div']),
};
render() {
const { children, ...restProps } = this.props;
return React.createElement(
this.props.elementType,
{
ref: node => (this.dom = node),
...restProps,
},
this.props.children
);
}
}
Getting the same issue with a similar (simple) code.
It seems the bug has already been fixed into master in https://github.com/yannickcr/eslint-plugin-react/commit/f227eb4e536426773c71674502958f0f96b75040
Yeah, a tag would be nice :P Ran into the same issue.
Same thing for style-prop-object?
I don't have the issue locally but have the error when running on circleci.. Not sure to know why :/
@kouhin can you confirm if the issue is still present on v6.4.1?
Confirmed it works with 6.4.1. My CI was using an old version from the cache.
@ljharb Confirmed with 6.4.1! Thanks
Most helpful comment
It seems the bug has already been fixed into master in https://github.com/yannickcr/eslint-plugin-react/commit/f227eb4e536426773c71674502958f0f96b75040