-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
react/no-unused-prop-types false positive #1008
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
Comments
This is probably related to / a duplicate of #811 |
This looks like a flow issue. Can we add a label please :) @ljharb thank you! |
I've just hit what I think is the same problem as this. Not sure if this helps you. File: https://github.com/guyellis/plant/blob/master/app/components/common/InputCombo.jsx Contents copied here in case it changes in the interim: const React = require('react');
const TextField = require('material-ui/TextField').default;
const PropTypes = require('prop-types');
function inputCombo(props) {
const {
changeHandler,
disabled = false,
error,
fullWidth = true,
label,
multiLine = false,
name: namo,
placeholder,
style = {},
type = 'text',
value,
} = props || {};
const underlineStyle = {
display: 'none',
};
const styler = Object.assign({
marginLeft: 20,
}, style);
return (
<TextField
disabled={disabled}
errorText={error}
floatingLabelText={label}
fullWidth={fullWidth}
hintText={placeholder}
multiLine={multiLine}
name={namo}
onChange={changeHandler}
style={styler}
type={type}
underlineStyle={underlineStyle}
value={value}
/>
);
}
inputCombo.propTypes = {
changeHandler: PropTypes.func.isRequired,
error: PropTypes.string,
fullWidth: PropTypes.bool,
label: PropTypes.string,
multiLine: PropTypes.bool,
name: PropTypes.string.isRequired, // eslint-disable-line no-dupe-keys
placeholder: PropTypes.string,
// eslint-disable-next-line react/forbid-prop-types
style: PropTypes.object,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]).isRequired,
};
inputCombo.defaultProps = {
error: '',
fullWidth: true,
label: '',
multiLine: false,
placeholder: '',
style: {},
};
module.exports = inputCombo; Error: https://travis-ci.org/guyellis/plant/builds/263855440 /home/travis/build/guyellis/plant/app/components/common/InputCombo.jsx
47:18 error 'changeHandler' PropType is defined but prop is never used react/no-unused-prop-types
48:10 error 'error' PropType is defined but prop is never used react/no-unused-prop-types
49:14 error 'fullWidth' PropType is defined but prop is never used react/no-unused-prop-types
50:10 error 'label' PropType is defined but prop is never used react/no-unused-prop-types
51:14 error 'multiLine' PropType is defined but prop is never used react/no-unused-prop-types
52:9 error 'name' PropType is defined but prop is never used react/no-unused-prop-types
53:16 error 'placeholder' PropType is defined but prop is never used react/no-unused-prop-types
55:10 error 'style' PropType is defined but prop is never used react/no-unused-prop-types
56:10 error 'value' PropType is defined but prop is never used react/no-unused-prop-types To reproduce, clone that repo and |
@guyellis your "plant" repo seems to have been deleted. If this is still a problem on the latest version of the plugin, please file a new issue with a repro. |
This code:
triggers this warning:
Though strangely, this code encounters no errors:
So you don't have to go hunting/searching, the only difference between them is the
object: ObjectType
vsobject: any
. (Not sure why changingUseDirectly
would affect the used-ness ofusedFromArray
field.)The text was updated successfully, but these errors were encountered: