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 "no-unused-prop-types" does not skip shape props properly #837

Closed
tristanbbq opened this issue Sep 15, 2016 · 2 comments
Closed

Rule "no-unused-prop-types" does not skip shape props properly #837

tristanbbq opened this issue Sep 15, 2016 · 2 comments
Assignees
Labels

Comments

@tristanbbq
Copy link

Rule:
"react/no-unused-prop-types": ["warn", { "customValidators": [], "skipShapeProps": true }],

Code sample:

import React, { PropTypes } from 'react';
import {
  ScrollView,
  Text,
} from 'react-native';

const UserDetails = ({ user }) => (
  <ScrollView>
    <Text>{user.name}</Text>
    <Text>{user.age}</Text>
    <Text>{user.gender}</Text>
    <Text>{user.email}</Text>
  </ScrollView>
);

UserDetails.propTypes = {
  user: PropTypes.shape({
    name: PropTypes.string.isRequired,
    age: PropTypes.number.isRequired,
    gender: PropTypes.string.isRequired,
    email: PropTypes.string.isRequired,
  }).isRequired,
};

This will give me false positives PropType is defined but props is never used.

References:
@EvNaverniouk : #611 (comment)

@EvHaus
Copy link
Collaborator

EvHaus commented Sep 30, 2016

I'm unable to reproduce this on the latest 6.3.0 version. Is this still happening for you @tristanbbq?

@tristanbbq
Copy link
Author

@EvNaverniouk sorry didn't get the chance to try it out again yet. Feel free to close if you think it's fixed.

@EvHaus EvHaus closed this as completed Oct 3, 2016
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

3 participants