Closed
Description
The prop-types
rule warns always if you don’t specify the propTypes
property within a react component even if you don’t use any props
.
I suggest to only warn if a used prop is not defined within propTypes
. This would also be good if you have specified the propTypes
property somehow but not defined every used prop.
So the following should not be considered as a warning:
var Hello = React.createClass({
render: function() {
return <div>Hello World</div>;
}
});
But this should be considered as a warning:
var Hello = React.createClass({
propTypes: {
name: React.PropTypes.string.isRequired
},
render: function() {
return <div>Hello {this.props.name} and {this.props.propWithoutTypeDefinition}</div>;
}
});