import React from "react";
var Hello = React.createClass({
propTypes: {
name: React.PropTypes.string
},
render: function() {
return <div>Hello Bob</div>;
}
});
This is almost identical to the first example in the docs.
$ eslint --no-eslintrc --parser-options="{sourceType: \"module\", ecmaVersion: 6, ecmaFeatures: {jsx:true}}" --plugin react --rule react/no-unused-prop-types:error js/Hello.jsx
# No errors shown.
By contrast, this does trigger:
import React from "react";
var Hello = React.createClass({
propTypes: {
name: React.PropTypes.string
},
render: function() {
return <div>Hello Bob {this.props.foo}</div>;
}
});
```bash
$ eslint --no-eslintrc --parser-options="{sourceType: \"module\", ecmaVersion: 6, ecmaFeatures: {jsx:true}}" --plugin react --rule react/no-unused-prop-types:error js/Hello.jsx
js/Hello.jsx
5:11 error 'name' PropType is defined but prop is never used react/no-unused-prop-types
✖ 1 problem (1 error, 0 warnings)
Both React.createClass and React.PropTypes are officially deprecated as of v15.5; but we should still fix this case.
I will work on it.
@ljharb , do you usually close issues after fix was merged to master or released or you follow some other process?
Ah, when the PR says fixes #x github does it for me :-)' (on merge)
Fixed in #1303.
Got it. Will follow that. Thanks!
Most helpful comment
I will work on it.