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

undefined error in style-prop-object #824

Closed
kouhin opened this issue Sep 13, 2016 · 8 comments
Closed

undefined error in style-prop-object #824

kouhin opened this issue Sep 13, 2016 · 8 comments
Labels

Comments

@kouhin
Copy link

kouhin commented Sep 13, 2016

> eslint 'src/**/*.js'

The react/require-extension rule is deprecated. Please use the import/extensions rule from eslint-plugin-import instead.
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/style-prop-object.js:51:34
    at Array.find (native)
    at EventEmitter.CallExpression (/Users/myabc/git/myproj/node_modules/eslint-plugin-react/lib/rules/style-prop-object.js:50:54)
    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/estraverse/estraverse.js:397:31)

VERSION:

    "eslint": "^3.3.0",
    "eslint-config-airbnb": "^11.1.0",
    "eslint-plugin-babel": "^3.3.0",
    "eslint-plugin-import": "^1.14.0",
    "eslint-plugin-jsx-a11y": "^2.2.2",
    "eslint-plugin-react": "^6.2.1",
@ljharb
Copy link
Member

ljharb commented Sep 13, 2016

What's the code this is erroring out on?

@ljharb
Copy link
Member

ljharb commented Sep 13, 2016

@kouhin either way, eslint-config-airbnb v11.1 requires eslint v3.5, and you have 3.3 - npm ls is likely reporting an error.

@kouhin
Copy link
Author

kouhin commented Sep 13, 2016

@ljharb Thanks. I will try to fix the required version.

This error occurs for every CI builds just from today, so I updated the deps by npm-check-updates('ncu -a -u'), and we got the style-prop-object error.

@kouhin
Copy link
Author

kouhin commented Sep 13, 2016

Sorry that I've made a mistake. Maybe ncu haven't updated all the packages.
I'll fix the version and try again.

@ljharb
Copy link
Member

ljharb commented Sep 13, 2016

For a package like eslint-config-airbnb that has peer dependencies, you should be updating manually.

@kouhin
Copy link
Author

kouhin commented Sep 15, 2016

@ljharb @yannickcr

Error pattern:

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
    );
  }
}

@lencioni lencioni added the bug label Sep 16, 2016
@lencioni
Copy link
Collaborator

@petersendidit Any chance you can look into this? Might be similar to #820

@lencioni
Copy link
Collaborator

I think this is a duplicate of #809. Closing this issue in favor of that one.

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

3 participants