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

Spread of any object into jsx causes react/prop-types to stop working (errors not detected) #1952

Closed
kitfit-dave opened this issue Aug 22, 2018 · 3 comments

Comments

@kitfit-dave
Copy link

Here is a minimal example:

import React from 'react'

class MyComponent extends React.Component {
	render() {
		// should be "'someProp' is missing in props validation (react/prop-types)" but is not
		this.props.someProp()

		return <div {...{}} />
	}
}

export default MyComponent

remove the spread {...{}} and everything is fine

@alexzherdev
Copy link
Contributor

This was filed as #1601 for no-unused-prop-types and there's an unfinished PR in #1646.
If #1946 is merged, the fix will go into that common helper and apply for both rules.

@kitfit-dave
Copy link
Author

Ah yeah, this seems fixed in master. At least now it does. I just added a test and noticed that it did not fail. :)

@ljharb
Copy link
Member

ljharb commented Aug 23, 2018

In that case, I'll close this now.

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

No branches or pull requests

3 participants