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

[Fix]:no-unused-prop-types: typescript interface support literal type and only FunctionComponent should have propTypes validation #2690

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

hank121314
Copy link
Contributor

This pr is trying to fix #2686 and #2689 .
To fix #2686 :

I add both string and number Literal type support to interface.

And to fix #2689 :

I add a validation for FunctionComponent in propTypes.js function markAnnotatedFunctionArgumentsAsDeclared which name isJSXFunctionComponent.It can check whether function is return JSXElement or not.

AFAIK only function that return JSXElement need propTypes validation.

Thanks you so much for your code review!

…rt literal type and only FunctionComponent should have propTypes validation

Fixes #2686. Fixes #2689.

Co-authored-by: Hank Chen <hank121314@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks; added a prop-types test as well from #2686.

@ljharb ljharb merged commit 4ee6f8e into jsx-eslint:master Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants