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

require-stateless-function throws "Cannot read property 'type' of undefined" #544

Closed
dallonf opened this issue Apr 12, 2016 · 1 comment
Closed
Labels

Comments

@dallonf
Copy link

dallonf commented Apr 12, 2016

Afraid I don't have time right now to write a really detailed report. Let me know if you need more information...

Node version: 5.3.0 (bit old now, I'll try upgrading in a bit and see if it helps)

Project is based on https://github.com/ryanflorence/react-project

Relevant bits of package.json:

{
    "eslint": "2.7.0",
    "eslint-config-airbnb": "7.0.0",
    "eslint-plugin-jsx-a11y": "0.6.2",
    "eslint-plugin-react": "4.3.0",
    "eslint-config-airbnb": "7.0.0",
    "eslint-plugin-jsx-a11y": "0.6.2"
}

.eslintrc:

{
  "extends": "airbnb",
  "globals": {
    "__DEV__": true
  },
  "rules": {
    "react/jsx-uses-react": 1,
    "react/jsx-no-undef": 2,
    "react/wrap-multilines": 2,
  }
}

Stack trace:

TypeError: Cannot read property 'type' of undefined
    at isRedundantSuperCall (<project directory>/node_modules/eslint-plugin-react/lib/rules/prefer-stateless-function.js:67:32)
    at <project directory>/node_modules/eslint-plugin-react/lib/rules/prefer-stateless-function.js:124:9
    at Array.some (native)
    at hasOtherProperties (<project directory>/node_modules/eslint-plugin-react/lib/rules/prefer-stateless-function.js:117:23)
    at EventEmitter.Program:exit (<project directory>/node_modules/eslint-plugin-react/lib/rules/prefer-stateless-function.js:223:11)
    at emitOne (events.js:82:20)
    at EventEmitter.emit (events.js:169:7)
    at NodeEventGenerator.leaveNode (<project directory>/node_modules/eslint/lib/util/node-event-generator.js:51:22)
    at CodePathAnalyzer.leaveNode (<project directory>/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:629:23)
    at CommentEventGenerator.leaveNode (<project directory>/node_modules/eslint/lib/util/comment-event-generator.js:112:23)

If I add "react/prefer-stateless-function": 0 to my .eslintrc's rules block, eslint works as usual.

@yannickcr
Copy link
Member

Ok, seems to be the same issue as eslint/eslint#5573 (part of the rule code come from the eslint no-useless-constructor rule)

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