-
Notifications
You must be signed in to change notification settings - Fork 1
jsx-no-invalid-props: Support & validate arguments to complex propTypes #1
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
Conversation
|
And it also adds support for |
|
Thanks for your work on this @xkr47 As this hasn't been touched for a while and was made for a very specific purpose I didn't have the whole pipeline setup for contribution. I've now added CI and linting. I've also upgraded eslint and fixed up the test configs as it was very out of date. If you could rebase and get everything linted and passing that would be good, ta. Looking at the PR. Just a couple of notes:
Thanks again |
|
Sounds great, I will look into it. Thanks for considering my submission! |
|
Rebased & linted. Bullet points not done yet. |
|
Test code cleaned. Should the expected errors also be moved to separate files e.g. |
|
Sorry couldn't resist to add support for contextTypes validation as well. It was too easy :) Anyway, I hope I have made all the changes you requested now. Care to take a look? |
According to https://facebook.github.io/react/docs/typechecking-with-proptypes.html there were flaws in the implementation and tests suggesting that you could specify proptypes like:
when the referenced documentation actually declares some of the proptypes (arrayOf etc) expect to be called like functions with specifically typed arguments. I have updated the code to support all variants documented in the above location. It ended up being quite a major overhaul. I also updated & added tests to match, including the example configuration from the above location as one test case.
I hope you can consider this, since the flaws have previously required me to disable the rule altogether when using more advanced proptype declarations.