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

Add support to ClassExpressions in the prop-types rule #1400

Merged
merged 4 commits into from Sep 5, 2017

Conversation

jseminck
Copy link
Contributor

I'm not super happy with the solution, perhaps others have a better idea?

It turns out that ESLint visits ClassExpression before it visits TypeParameterDeclaration, but I want it the other way around.

I tried using the ClassExpression:exit key, but it doesn't change anything.

Therefore, I needed a way to defer class expressions evaluations util after TypeParameterDeclaration has been visited, by storing the nodes in an array and looping through it in Program:exit.

This fixes #1376 (comment) and several other cases which we didn't catch before.

I'm not sure it will cover all of the issues related to Flow Props yet.

I'll add the same support to no-unused-prop-types in #1393

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.

This seems like the proper approach to me

@johnhaley81
Copy link

@jseminck I just tested this out in my code and it's working great!

@yannickcr yannickcr merged commit ce09993 into jsx-eslint:master Sep 5, 2017
@jseminck jseminck deleted the flow-53-hoc branch November 19, 2017 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Flow 0.53 prop types
4 participants