-
Notifications
You must be signed in to change notification settings - Fork 71
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 schema checking for plugin options #312
Comments
So I looked through the Several libraries were mentioned there, but none chosen, and the issue was closed as stale eventually. Previous Art and references in the interface space: MST is great (also has made some of my IDEs really chug on the types 😅 ) and not deprecated, but afaik, there's no way to decouple the schema/models from the state tree portion of it for use in pure schema validation; I'd probably already have used it by now otherwise... 😕 MST and other previous art (React |
Recently found https://github.com/moltar/typescript-runtime-type-benchmarks and figured I'd notate some more here. While the benchmarks themselves aren't super relevant for our use-case given that they'd only run once per build, the repo also contains a long list of different TS runtime type-checking tools. But tbh, the most popular of the lot is still
In any case, most schema / runtime type-checking libraries nowadays can derive / infer a TS interface from the schema, so you still only need to define the schema once. Adding a TS transformer to our own build pipeline adds a new complexity (though it would be dogfooding more), so I think I'm more for just adding a run-time schema like |
What kind of feature would you like and why?
This is a feature request, not a bug -- need to make a different issue template for that.
Schema checking for plugin options would improve the DX of this plugin by catching some common user errors / misconfigurations early on. For instance, #236 and #229 (and partly #62) are both due to trying to place
compilerOptions
directly into this plugin's options, and not intsconfigOverrides.compilerOptions
. #159 and #157 are also similar in that they were missingcompilerOptions
(and the answer in #157 (comment) has 12+ upvotes, so seems to be a general point of confusion, possibly due to configuration differences b/t rpt and rpt2).Most of the issues labeled
solution: invalid
are due to these "invalid" misconfigurations (may want to make a more specific label for that though...)This kind of validation would also hopefully help reduce the amount of erroneous bug reports due to misconfigurations that this plugin receives.
Implementation Details
A simple, naive, first-pass implementation of this could be to just check if all first-level keys passed into this plugin's options are valid options.
More in-depth implementations can check a full schema and deeper levels, but I think the first-pass would actually handle 80%+ of these kinds of issues
Versions
The text was updated successfully, but these errors were encountered: