It is frustrating that babel-cli program does not validate options that are passed to it, e.g.
babel ./src --out-dir ./dist --copy-files --spurce-maps
This will run the program without any error (note the spelling error in --spurce-maps; the intetended value is --source-maps).
Ideally, a CLI program should throw an error whenever an unknown property/ value is passed to it.
As far as I can tell, https://github.com/tj/commander.js does not support "strict" options parameter (like yargs#strict). Therefore, this could be achieved by:
- switching the implementation to yargs; or
- implementing JSON schema validation of the options object
It is frustrating that
babel-cliprogram does not validate options that are passed to it, e.g.This will run the program without any error (note the spelling error in
--spurce-maps; the intetended value is--source-maps).Ideally, a CLI program should throw an error whenever an unknown property/ value is passed to it.
As far as I can tell, https://github.com/tj/commander.js does not support "strict" options parameter (like yargs#strict). Therefore, this could be achieved by: