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

TypeError: Cannot read property 'forEach' of undefined makes eslint crash eslint-plugin-react\lib\rules\forbid-prop-types #2691

Closed
MohammedYacub1029 opened this issue Jun 30, 2020 · 3 comments

Comments

@MohammedYacub1029
Copy link

TypeError: Cannot read property 'forEach' of undefined
at checkProperties (reactworks\workspace\mui\node_modules\eslint-plugin-react\lib\rules\forbid-prop-types.js:91:20)
at CallExpression (reactworks\workspace\mui\node_modules\eslint-plugin-react\lib\rules\forbid-prop-types.js:173:11)
at reactworks\workspace\mui\node_modules\eslint\lib\util\safe-emitter.js:47:58
at Array.forEach ()
at Object.emit (reactworks\workspace\mui\node_modules\eslint\lib\util\safe-emitter.js:47:38)
at NodeEventGenerator.applySelector (reactworks\workspace\mui\node_modules\eslint\lib\util\node-event-generator.js:251:26)
at NodeEventGenerator.applySelectors (reactworks\workspace\mui\node_modules\eslint\lib\util\node-event-generator.js:280:22)
at NodeEventGenerator.enterNode (reactworks\workspace\mui\node_modules\eslint\lib\util\node-event-generator.js:294:14)
at CodePathAnalyzer.enterNode (reactworks\workspace\mui\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23)
at Traverser.enter [as _enter] (reactworks\workspace\mui\node_modules\eslint\lib\linter.js:865:28)
at Traverser._traverse (reactworks\workspace\mui\node_modules\eslint\lib\util\traverser.js:132:14)
at Traverser._traverse (reactworks\workspace\mui\node_modules\eslint\lib\util\traverser.js:147:30)
at Traverser._traverse (reactworks\workspace\mui\node_modules\eslint\lib\util\traverser.js:144:34)
at Traverser._traverse (reactworks\workspace\mui\node_modules\eslint\lib\util\traverser.js:147:30)
at Traverser._traverse (reactworks\workspace\mui\node_modules\eslint\lib\util\traverser.js:144:34)
at Traverser._traverse (reactworks\workspace\mui\node_modules\eslint\lib\util\traverser.js:147:30)

when i change "react/forbid-prop-types": [2, { "forbid": ["any"] }], to "react/forbid-prop-types": [0, { "forbid": ["any"] }], in .eslintrc.json file error does not occur

versions:
Node: v12.14.0
react:16.13.1
eslint:4.19.1
eslint-react-plugin :7.20.2(which is published 15 hours ago)

@ljharb
Copy link
Member

ljharb commented Jun 30, 2020

Do you know what code this is crashing on?

@ljharb
Copy link
Member

ljharb commented Jun 30, 2020

Specifically, this was fixed in a9d2621 / #2682, which is included in v7.20.2. Are you sure that's the version you're using?

@ljharb
Copy link
Member

ljharb commented Jun 30, 2020

v7.20.3 is released as well; so i'm going to close this, but will promptly reopen if you confirm this bug is still somehow happening (it should be impossible to call forEach on undefined in this codepath since v7.20.2)

@ljharb ljharb closed this as completed Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants