this is working :
class Foo extends React.Component {
render: function () {
return <div>{this.props.bar.baz}</div>
}
}
Foo.propTypes = {
bar: React.PropTypes.shape({
baz: React.PropTypes.string // ok
})
};
but this seems not work:
class Foo extends React.Component {
const bar = this.props.bar;
render: function () {
return <div>{bar.baz}</div>
}
}
Foo.propTypes = {
bar: React.PropTypes.shape({
baz: React.PropTypes.string // not ok, Prop defined but not used
})
};
seems no-unused-prop-types rule cause this bug
and many others :
#810 #811 #818 #816 #818 #819 #823 #836 #837 #840 #851 #855 #861 #871
The no-unused-prop-types rule does not support shape props at the moment as such detection is very difficult. If you use shape props, I recommend setting the skipShapeProps option to true on the rule.
Duplicate of #819. Will track further discussion of shape props there.
Is this still unsupported?
Most helpful comment
seems
no-unused-prop-typesrule cause this bugand many others :
#810 #811 #818 #816 #818 #819 #823 #836 #837 #840 #851 #855 #861 #871