Skip to content
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

no-unused-prop-types rule not detect nest object #847

Closed
mydearxym opened this issue Sep 17, 2016 · 3 comments
Closed

no-unused-prop-types rule not detect nest object #847

mydearxym opened this issue Sep 17, 2016 · 3 comments
Labels

Comments

@mydearxym
Copy link

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
    })
};
@mydearxym
Copy link
Author

mydearxym commented Sep 17, 2016

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

@mydearxym mydearxym changed the title forbid-prop-types rule not detect nest object no-unused-prop-types rule not detect nest object Sep 17, 2016
@EvHaus
Copy link
Collaborator

EvHaus commented Sep 30, 2016

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.

@EvHaus EvHaus closed this as completed Oct 1, 2016
@alenia
Copy link

alenia commented Apr 15, 2017

Is this still unsupported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants