Closed
Description
Is it an oversight or a limitation that for the react/prop-types
rule, no warning is emitted for missing nested properties.
For example, with:
propTypes: {
a: React.PropTypes.shape({
b: React.PropTypes.shape({
c: React.PropTypes.func
})
})
}
I get no warning when I use this.props.a.b.d
.
Thank you!
Activity
Cellule commentedon Jun 15, 2015
If this is something we want to add support for. I fiddled with it a bit tonight and I got something working for quite a few nested cases.
It checks for
shape
arrayOf
objectOf
oneOfType
andinstanceOf
.I need to do some additional testing, but so far it look pretty solid. I can event do checks like
this.props.a[0][someVar].e
and give warning aboute
if the propTypes areLet me know if you want me to polish it.
In case you're interested to see what I did so far
master...Cellule:prop_type
yannickcr commentedon Jun 15, 2015
Wow. That's definitely something we're interested in. I did not dive in your code yet but it seems great so far.
You can polish it, I will be very happy to merge it :)
Merge pull request #112 from Cellule/nested_prop_types
release(version): Release 1.1.0 [skip ci]
fix(deps): update dependency eslint-plugin-react to v7.35.0
fix(deps): update dependency eslint-plugin-react to v7.35.0
fix(deps): update dependency eslint-plugin-react to v7.35.0
fix(deps): update dependency eslint-plugin-react to v7.35.0
fix(deps): update dependency eslint-plugin-react to v7.35.0
fix(deps): update dependency eslint-plugin-react to v7.35.0
36 remaining items