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

Fix void-dom-elements-no-children crash #1226

Merged
merged 4 commits into from Jul 2, 2017
Merged

Fix void-dom-elements-no-children crash #1226

merged 4 commits into from Jul 2, 2017

Conversation

cove-io
Copy link
Contributor

@cove-io cove-io commented May 27, 2017

React.createElement() currently crashes the linter with the following error and linting doesn't happen:

image

events.js:106 Cannot read property 'value' of undefined TypeError: Cannot read property 'value' of undefined

Of course React.createElement() will cause a runtime error, but it shouldn't crash the linter.

kokobeware added 3 commits May 27, 2017 15:29
React.createElement() crashes the linter since first argument is undefined.
@@ -54,6 +54,10 @@ ruleTester.run('void-dom-elements-no-children', rule, {
}, {
code: 'React.createElement("img");'
}, {
code: 'React.createElement();'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this shouldn't be valid; altho maybe this rule shouldn't be handling it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, a different rule that checks for required parameters to React methods would be good. Maybe it could even give a hint on the order and nature of the parameters without needing to go to the docs.

@ljharb ljharb added the bug label May 27, 2017
@yannickcr yannickcr merged commit 4a35536 into jsx-eslint:master Jul 2, 2017
@yannickcr
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants