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

forbid-prop-types crashes on PropTypes.shape #2682

Closed
MhMadHamster opened this issue Jun 29, 2020 · 3 comments
Closed

forbid-prop-types crashes on PropTypes.shape #2682

MhMadHamster opened this issue Jun 29, 2020 · 3 comments

Comments

@MhMadHamster
Copy link

MhMadHamster commented Jun 29, 2020

eslint: v7.3.1
eslint-plugin-react: v7.20.1

Code:

import PropTypes from "prop-types";

const Foo = {
	foo: PropTypes.string,
};

const Bar = {
	bar: PropTypes.shape(Foo),
};

Error:

TypeError: Cannot read property 'forEach' of undefined
Occurred while linting C:\Projects\test\index.js:8
    at checkProperties (C:\Projects\test\node_modules\eslint-plugin-react\lib\rules\forbid-prop-types.js:91:20)
    at CallExpression (C:\Projects\test\node_modules\eslint-plugin-react\lib\rules\forbid-prop-types.js:173:11)
    at C:\Projects\test\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Projects\test\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\Projects\test\node_modules\eslint\lib\linter\node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (C:\Projects\test\node_modules\eslint\lib\linter\node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (C:\Projects\test\node_modules\eslint\lib\linter\node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (C:\Projects\test\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:635:23)
    at C:\Projects\test\node_modules\eslint\lib\linter\linter.js:949:32
@Aerendir
Copy link

I have the same error.

@ljharb ljharb closed this as completed in a9d2621 Jun 29, 2020
@ljharb
Copy link
Member

ljharb commented Jun 29, 2020

Thanks for the repro; I'll have the fix released later today.

@ljharb
Copy link
Member

ljharb commented Jun 29, 2020

v7.20.2 is released.

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