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

Rule request: Prevent unused prop in component definition #583

Closed
mocheng opened this issue May 3, 2016 · 3 comments
Closed

Rule request: Prevent unused prop in component definition #583

mocheng opened this issue May 3, 2016 · 3 comments

Comments

@mocheng
Copy link

mocheng commented May 3, 2016

Suppose propTypes states one prop to be isRequired, but that prop is not used in component definition. This could be a problem.

For the time being, React reports a warning like

Warning: Failed propType: Required prop xxxxxx was not specified in XXXXXX. Check the render method of Connect(XXXXX)

It would be nice to have it reported as error in lint phase.

@lo1tuma
Copy link

lo1tuma commented May 3, 2016

Looks like a duplicate of #226.

@ljharb
Copy link
Member

ljharb commented May 3, 2016

This is similar to #226 but slightly different in that it's separately warning on missing required props. I'll leave both open, but I think both could be handled by one rule with an option to restrict enforcement to missing required props.

@yannickcr
Copy link
Member

Yes, same rule as #226. I am not convinced of the utility for an option to only warn on required props though. We can discuss it in #226.

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

No branches or pull requests

4 participants