babel/minify

Options validation for preset

Open

#436 opened on 2017年2月20日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)JavaScript (223 forks)batch import
enhancementgood first issuehelp wanted

Repository metrics

Stars
 (4,377 stars)
PR merge metrics
 (30d に merged 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
    })
  };
}

コントリビューターガイド