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

Regression in prop-types rule v7.13.0 #2298

Closed
willdurand opened this issue Jun 3, 2019 · 2 comments
Closed

Regression in prop-types rule v7.13.0 #2298

willdurand opened this issue Jun 3, 2019 · 2 comments
Assignees
Labels

Comments

@willdurand
Copy link

The prop-types rule reports false-positives when we upgraded from version 7.12.0 to 7.13.0. I believe this is related to #2241 and Flow.

Example

type Props = {|
  _value?: number
|};

function App({ _value = defaultValue }: Props = {}) {
  ...
}

What happened?

error  '_value' is missing in props validation  react/prop-types

What did you expect to happen?

No error.

Other information

It worked until 7.12.0 but it fails with 7.13.0.

I created a demo project to reproduce the bug: https://github.com/willdurand/eslint-issue-prop-types.

@ljharb ljharb added the flow label Jun 3, 2019
@ljharb
Copy link
Member

ljharb commented Jun 3, 2019

I think the issue is that you've defaulted the props arg to {}, for no reason I can see - props are unconditionally provided to react components.

What happens if you remove = {}?

@yannickcr yannickcr self-assigned this Jun 23, 2019
@yannickcr
Copy link
Member

Thank you for the demo project, it was very helpful.

It should be fixed in next release 🙂

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