babel/minify

Options validation for preset

Open

#436 geöffnet am 20. Feb. 2017

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (223 Forks)batch import
enhancementgood first issuehelp wanted

Repository-Metriken

Stars
 (4.377 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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
    })
  };
}

Contributor Guide