-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
Improve configuration validation #572
Conversation
Codecov Report
@@ Coverage Diff @@
## master #572 +/- ##
==========================================
+ Coverage 98.02% 98.14% +0.12%
==========================================
Files 13 13
Lines 354 377 +23
Branches 45 52 +7
==========================================
+ Hits 347 370 +23
Misses 7 7
Continue to review full report at Codecov.
|
I’m wondering why you decided to ditch the jest-validate since it was giving the flexibility of providing it with updated config a and get the deprecation warnings automatically. Also lots of these now hard coded checks does make the code less maintable. Have you considered adding the fix as a special case like we did with globs? |
Because in the current version, jest-validate can't handle different types in the same fields, this will come in version 24 (https://github.com/facebook/jest/blob/master/packages/jest-validate/src/index.js#L18) Also, jest-validate while being easier to setup is way less precise as it stops at the type of value in the field. |
I’m wondering when 24 is going to be released and if we can contribute our use case to it. The reason I pushing back is that change going to introduce a lot of chore related to the config to maintainers (reas: me) and I don’t have enough time for this right now. So if we could stick to an automated yet not perfect solution I’d prefer that instead. |
I'll check for alternative solutions then |
Hi @okonet, I changed the implementation to use In exchange, the configuration validation is more precise and I added more tests to ensure it won't take you by surprise in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's much better! Thanks for working on it.
BTW I noticed that Jest v24 was released but I guess jest-validate still has some limitations, right? |
🎉 This PR is included in version 8.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Awesome, thanks for the release :) I also saw it was released, It solves the issue of having multiple types for the same field, which is one part of the PR. It doesn't help have more precise diagnostics on the types and linter object |
Fixes #567
This pull request introduces a custom validator that replaces
jest-validate
Improvements over the previous implementations are:
renderer
are now explicit, where any string was possible beforeignore
is an array of stringsI tried to use
joy
yup
andschema-utils
to express the schema to validate, but it felt more verbose and less flexible with regard to the number of possible options.I just ensured that current tests pass, I can write more tests if needed.