mirror of
https://git.proxmox.com/git/pve-eslint
synced 2025-11-04 18:03:21 +00:00
add --output-config CLI option
can help to get the default config for adaption Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
177b4d5ea7
commit
4e679d18a2
12
src/app.js
12
src/app.js
@ -9,7 +9,9 @@ program
|
||||
.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('');
|
||||
@ -26,7 +28,7 @@ if (program.config && program.extend) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (program.args.length < 1) {
|
||||
if (program.args.length < 1 && !program.outputConfig) {
|
||||
program.help();
|
||||
}
|
||||
|
||||
@ -246,6 +248,12 @@ if (program.config) {
|
||||
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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user