Skip to content

Cannot read property 'type' of undefined #1586

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

Closed
syakuis opened this issue Dec 6, 2017 · 3 comments
Closed

Cannot read property 'type' of undefined #1586

syakuis opened this issue Dec 6, 2017 · 3 comments

Comments

@syakuis
Copy link

syakuis commented Dec 6, 2017

type object undefined checking required ...

"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",

$ eslint ~/path/

error log

Cannot read property 'type' of undefined
TypeError: Cannot read property 'type' of undefined
    at checkValidPropObject (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js:76:15)
    at checkValidProp (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js:65:11)
    at node.properties.forEach.prop (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js:77:41)
    at Array.forEach (native)
    at checkValidPropObject (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js:77:25)
    at reportErrorIfClassPropertyCasingTypo (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js:85:9)
    at MemberExpression (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint-plugin-react/lib/rules/no-typos.js:135:11)
    at listeners.(anonymous function).forEach.listener (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (native)
    at Object.emit (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)
    at Traverser.enter (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/eslint/lib/linter.js:956:32)
    at Traverser.__execute (/Users/syaku/develop/IntelliJ/portal/frontend/node_modules/estraverse/estraverse.js:397:31)

my code cause

Link.propTypes = {
  url: PropTypes.string,
  urlMode: PropTypes.string,
  children: PropTypes.node,
  style: PropTypes.shape(),  // <--- here cause 
  options: PropTypes.shape({
    name: PropTypes.string,
    width: PropTypes.number,
    height: PropTypes.number,
  }),
};
style: PropTypes.shape({}) // <---- resolved
@jseminck
Copy link
Contributor

jseminck commented Dec 6, 2017

We should probably fix this, but what does it mean when you define a prop as PropTypes.shape(). Does it even make sense to have this?

@syakuis
Copy link
Author

syakuis commented Dec 6, 2017

That code is my fault. However, I could not figure out where the error occurred, so I had trouble solving it.

@ljharb
Copy link
Member

ljharb commented Dec 6, 2017

This is a duplicate of #1471.

@ljharb ljharb closed this as completed Dec 6, 2017
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