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

Crash when using for loop iterator variable as prop value #2102

Closed
dzek69 opened this issue Jan 1, 2019 · 3 comments
Closed

Crash when using for loop iterator variable as prop value #2102

dzek69 opened this issue Jan 1, 2019 · 3 comments
Assignees

Comments

@dzek69
Copy link
Contributor

dzek69 commented Jan 1, 2019

This plugin crashes on this code (this is the simplest readable code, don't mind it's not very useful)

const Example = props => {
    for (let i = 0; i < length; i++) {
        return <Text key={i} />;
    }
};
TypeError: Cannot read property 'type' of null
    at isJSXElement (C:\Users\dzek\Projects\my-project\node_modules\eslint-plugin-react\lib\rules\jsx-max-depth.js:43:19)
    at find (C:\Users\dzek\Projects\my-project\node_modules\eslint-plugin-react\lib\rules\jsx-max-depth.js:93:20)
    at findJSXElement (C:\Users\dzek\Projects\my-project\node_modules\eslint-plugin-react\lib\rules\jsx-max-depth.js:104:49)
    at JSXExpressionContainer (C:\Users\dzek\Projects\my-project\node_modules\eslint-plugin-react\lib\rules\jsx-max-depth.js:139:25)
    at listeners.(anonymous function).forEach.listener (C:\Users\dzek\Projects\my-project\node_modules\eslint\lib\util\safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\dzek\Projects\my-project\node_modules\eslint\lib\util\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (C:\Users\dzek\Projects\my-project\node_modules\eslint\lib\util\node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (C:\Users\dzek\Projects\my-project\node_modules\eslint\lib\util\node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (C:\Users\dzek\Projects\my-project\node_modules\eslint\lib\util\node-event-generator.js:294:14)
@ljharb ljharb self-assigned this Jan 1, 2019
@ljharb ljharb closed this as completed in 146d8d1 Jan 1, 2019
@ljharb
Copy link
Member

ljharb commented Jan 1, 2019

Thanks for the great repro code; that helped a ton :-)

@dzek69
Copy link
Contributor Author

dzek69 commented Jan 1, 2019

I just realized that I could include my config. I'm glad it's fixed, thank you :)

@ljharb
Copy link
Member

ljharb commented Jan 1, 2019

v17.12.1 is released.

This was referenced Jan 1, 2019
This was referenced Jan 7, 2019
@ghost ghost mentioned this issue Jan 12, 2019
1 task
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