.usage('[options] [<file(s) ...>]')
.option('-c, --config <configfile>', 'uses <configfile> for eslint config instead.')
.option('-e, --extend <configfile>', 'uses <configfile> ontop of default eslint config.')
- .option('-f, --fix', 'if set, fixes will be applied.');
+ .option('-f, --fix', 'if set, fixes will be applied.')
+ .option('--output-config', 'if set, only output the config as JSON and exit.')
+ ;
program.on('--help', function() {
console.log('');
process.exit(1);
}
-if (program.args.length < 1) {
+if (program.args.length < 1 && !program.outputConfig) {
program.help();
}
console.log(`Extend with path: ${config.extends}`);
}
+if (program.outputConfig) {
+ let cfg = JSON.stringify(config, null, 2);
+ console.log(cfg);
+ process.exit(0);
+}
+
const cli = new eslint.CLIEngine({
baseConfig: config,
useEslintrc: true,