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

incorrect prop-types error for VFC #3230

Closed
dlech opened this issue Mar 1, 2022 · 5 comments · Fixed by #3246
Closed

incorrect prop-types error for VFC #3230

dlech opened this issue Mar 1, 2022 · 5 comments · Fixed by #3246

Comments

@dlech
Copy link
Contributor

dlech commented Mar 1, 2022

This is essentially the same issue as #3090 except that the VFC abbreviation was also overlooked in the fix that closed that issue. Basically the same changes need to be made as in #3092 except replace VoidFunctionComponent with VFC.

@dlech dlech changed the title prop-types error for VFC incorrect prop-types error for VFC Mar 1, 2022
@ljharb
Copy link
Member

ljharb commented Mar 1, 2022

Presumably both VFC and VoidFunctionComponent are provided as types?

@dlech
Copy link
Contributor Author

dlech commented Mar 1, 2022

Yes. See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f3875116e52fe94338292fc418c89b2ef8216c4c/types/react/index.d.ts#L557.

@ljharb ljharb closed this as completed in d9531c3 Mar 1, 2022
@dlech
Copy link
Contributor Author

dlech commented Mar 16, 2022

This does not seem to be fixed after updating to v7.29.4.

Maybe we missed adding VFC here?

https://github.com/yannickcr/eslint-plugin-react/blob/d9531c3bc539e292eb297a04c7b9312e8b63a223/lib/util/propTypes.js#L104-L113

@ljharb
Copy link
Member

ljharb commented Mar 16, 2022

@dlech seems plausible :-) can you file a new issue, or better, a PR with a failing test case?

@dlech
Copy link
Contributor Author

dlech commented Mar 16, 2022

PR with a failing test case?

done

dlech added a commit to dlech/eslint-plugin-react that referenced this issue Mar 16, 2022
In d9531c3, we missed adding VFC to genericTypeParamIndexWherePropsArePresent in addition to allowedGenericTypes.

This adds some failing tests and fixes the issue.

Fixes: jsx-eslint#3230
ljharb pushed a commit to dlech/eslint-plugin-react that referenced this issue Mar 16, 2022
In d9531c3, we missed adding VFC to genericTypeParamIndexWherePropsArePresent in addition to allowedGenericTypes.

This adds some failing tests and fixes the issue.

Fixes jsx-eslint#3230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants