Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

Allow skipShapeProps in react/no-unused-prop-types #21

Closed
danielkraus opened this issue Aug 3, 2017 · 4 comments
Closed

Allow skipShapeProps in react/no-unused-prop-types #21

danielkraus opened this issue Aug 3, 2017 · 4 comments
Assignees

Comments

@danielkraus
Copy link
Member

danielkraus commented Aug 3, 2017

Why do we have skipShapeProps: false for this rule?

Let's say I have:

Navigation.propTypes = {
 links: PropTypes.arrayOf(
    PropTypes.shape({
      url: PropTypes.string.required,
      label: PropTypes.string.isRequired,
    })
  ).isRequired,
 categoryTitle: PropTypes.string.isRequired,
}

Then I get

[eslint] 'links.*.url' PropType is defined but prop is never used (react/no-unused-prop-types)

I think we should set skipShapeProps to true. Or am I missing something? I found the similar issue that describes the problem more for example here jsx-eslint/eslint-plugin-react#819.

@robertrossmann
Copy link
Member

@dannytce indeed, why? I thought skipping any type of props validation is not a good thing but if you guys have valid reasons to turn that option off I'm okay with it.

@robertrossmann
Copy link
Member

ping @dannytce.

@petrhanak
Copy link
Contributor

@robertrossmann Rule react/no-unused-prop-types is broken. It should be set to only warning level with skipShapeProps: true as it is causing a lot of false positives.

https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md#known-issueslimitations

Details discussed here jsx-eslint/eslint-plugin-react#976

@robertrossmann
Copy link
Member

Fixed in 7.5.0 🎉

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

No branches or pull requests

4 participants