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

False positive in react/prop-types #1623

Closed
jalooc opened this issue Dec 22, 2017 · 2 comments
Closed

False positive in react/prop-types #1623

jalooc opened this issue Dec 22, 2017 · 2 comments

Comments

@jalooc
Copy link

jalooc commented Dec 22, 2017

Eslint detects react/prop-types rule violation in the following code:

const map = {
  one: {
    component: One,
  },
  two: {
    component: Two,
    withMargin: true,
  },
}

const Part = props => {
  if (!map[props.type]) return null

  const { component: Component, withMargin } = map[props.type]

  return <Component {...props} withMargin={withMargin} />
}

Part.propTypes = {
  type: PropTypes.string.isRequired,
}
error  '.component' is missing in props validation   react/prop-types
error  '.withMargin' is missing in props validation  react/prop-types

@alexzherdev
Copy link
Contributor

This looks like a duplicate to #1259

@ljharb
Copy link
Member

ljharb commented Jun 30, 2018

Yes, closing as a duplicate, thanks.

@ljharb ljharb closed this as completed Jun 30, 2018
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