Skip to content

Prop usage is not detected #1107

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

Closed
budde377 opened this issue Mar 9, 2017 · 3 comments
Closed

Prop usage is not detected #1107

budde377 opened this issue Mar 9, 2017 · 3 comments

Comments

@budde377
Copy link

budde377 commented Mar 9, 2017

The following code:

const React = require('react')
const someArray = require('./someArray')

const Test = props => <div>
    {someArray.map(l => <div
      key={l}>
        {props.property + props.property2}
      </div>)}
  </div>

Test.propTypes = {
  property: React.propTypes.string.isRequired,
  property2: React.propTypes.string.isRequired
}

raises error

  12:13  error  'property' PropType is defined but prop is never used  react/no-unused-prop-types

with eslint-plugin-react version 6.10.0.

@ljharb
Copy link
Member

ljharb commented Mar 12, 2017

What is [].suppoerted? that's not a property that would exist on arrays?

@budde377
Copy link
Author

@ljharb That was a typo. I have corrected the example.

@sospedra
Copy link

Can confirm on v6.10.3
It's because is inside the map function :/

DianaSuvorova added a commit to DianaSuvorova/eslint-plugin-react that referenced this issue Jul 28, 2017
DianaSuvorova added a commit to DianaSuvorova/eslint-plugin-react that referenced this issue Jul 28, 2017
ljharb added a commit that referenced this issue Jul 28, 2017
`no-unused-prop-types`: add `.map` test case from #1107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants