babel/minify

Options validation for preset

开放

#436 创建于 2017年2月20日

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (223 个派生)batch import
enhancementgood first issuehelp wanted

仓库指标

星标
 (4,377 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

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.

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

贡献者指南