Conversation
560296e to
725c437
Compare
|
Shameless plug. I wrote a library to do just this with a clean fluent API. https://github.com/milesj/optimal |
|
@milesj Thanks for the info. We haven't decided yet how the preset option validation should be reworked. During talks to @nicolo-ribaudo, he proposes a JSON-schema based validator so we can ship schema for better integration to IDE. The goal is to help developers write correct configuration instead of to discourage them via complicated validate message. This PR is only meant to extend the current validation logic from preset-env to other three babel presets. We can switch to a more formal validation libraries later but this PR should be complete for UI visibility. |
07f12f7 to
cb15988
Compare
b193be2 to
43418f1
Compare
|
This PR has been revamped featuring less boilerplate of option validation. |
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/24696/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 6cc4a72:
|
46678cc to
007c944
Compare
007c944 to
6cc4a72
Compare
The design is copied from preset-env. To avoid duplicate codes, we can extract the validators into a helper library. Ideally we can use schema to check these types, but this PR should include the only visible breaking changes: we are now throwing type errors like
useBuiltIns: 0or invalid optionsuseBuiltins: trueinstead of accepting/discarding them silently.Todo: