babel / babel/minify

Options validation for preset

Open
#436 1 comment 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
JavaScript
Stars
4.4k
Forks
217
PR merge metrics
No merged PRs in 30d

Description

Validate the entire tree of options passed to preset.

Maybe, each plugin can export a list of options that only babili preset understands and we can validate them only when using the preset and not when using the plugin separately.

```js
module.exports = function plugin() {};
module.exports.options = PropTypes.object({
n: PropTypes.number
});
```

Or, this can be implemented in babel - where validator is built into babel for plugins and presets.

```js
function plugin({ PropTypes }) {
return {
visitor: {...}
options: PropTypes.object({
n: PropTypes.number
})
};
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.