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

PropTypes.shape with error #823

Closed
learning opened this issue Sep 13, 2016 · 2 comments
Closed

PropTypes.shape with error #823

learning opened this issue Sep 13, 2016 · 2 comments
Labels

Comments

@learning
Copy link

I have something like this

import React, { PropTypes } from 'react';

function Summary({index, day }) {
  return (
    <li>
      <h3>{index + 1}</h3>
      <p>{day.todos.map(todo => todo.title).join(',')}</p>
    </li>
  );
}

Summary.propTypes = {
  index: PropTypes.number,
  day: PropTypes.shape({
    todos: PropTypes.arrayOf(PropTypes.shape({
      title: PropTypes.string,
    })),
  }),
};

when I run lint, I got this error.

**:**  error  'day.todos' PropType is defined but prop is never used            react/no-unused-prop-types
**:**  error  'day.todos.*.title' PropType is defined but prop is never used    react/no-unused-prop-types
@zerkms
Copy link

zerkms commented Sep 14, 2016

Relevant (or a duplicate?): #816

@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
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