Skip to content

Commit 1bdc749

Browse files
authored
Reformat code with Prettier (#2180)
1 parent 6fc933e commit 1bdc749

File tree

132 files changed

+3056
-2160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+3056
-2160
lines changed

eslint.config.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@ const tseslintConfigs = tseslint.config(
1414
languageOptions: {
1515
parserOptions: { project: './tsconfig.js.json' },
1616
},
17-
extends: [
18-
...tseslint.configs.recommended,
19-
],
17+
extends: [...tseslint.configs.recommended],
2018
rules: {
2119
'@typescript-eslint/no-var-requires': 'off', // (tseslint does not autodetect commonjs context )
2220
},
23-
}, {
21+
},
22+
{
2423
files: tsconfigTsFiles,
2524
languageOptions: {
2625
parserOptions: { project: './tsconfig.ts.json' },
2726
},
28-
extends: [
29-
...tseslint.configs.recommended,
30-
],
27+
extends: [...tseslint.configs.recommended],
3128
},
3229
);
3330

@@ -59,17 +56,20 @@ module.exports = [
5956
files: ['**/*.test.{js,mjs,cjs}'],
6057
rules: {
6158
'no-unused-vars': 'off', // lots in tests, minimise churn for now
62-
}
59+
},
6360
},
6461
{
6562
files: [...tsconfigTsFiles, ...tsconfigJsFiles],
6663
rules: {
67-
'@typescript-eslint/ban-ts-comment': ['error', {
68-
'ts-expect-error': 'allow-with-description',
69-
'ts-ignore': 'allow-with-description',
70-
'ts-nocheck': true,
71-
'ts-check': true,
72-
}],
64+
'@typescript-eslint/ban-ts-comment': [
65+
'error',
66+
{
67+
'ts-expect-error': 'allow-with-description',
68+
'ts-ignore': 'allow-with-description',
69+
'ts-nocheck': true,
70+
'ts-check': true,
71+
},
72+
],
7373
},
7474
},
7575
];

esm.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export const {
1212
Command,
1313
Argument,
1414
Option,
15-
Help
15+
Help,
1616
} = commander;

examples/action-this.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ program
99
.command('serve')
1010
.argument('<script>')
1111
.option('-p, --port <number>', 'port number', 80)
12-
.action(function() {
12+
.action(function () {
1313
console.error('Run script %s on port %s', this.args[0], this.opts().port);
1414
});
1515

examples/arguments-extra.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,19 @@ const commander = require('commander');
66
const program = new commander.Command();
77

88
program
9-
.addArgument(new commander.Argument('<drink-size>', 'drink cup size').choices(['small', 'medium', 'large']))
10-
.addArgument(new commander.Argument('[timeout]', 'timeout in seconds').default(60, 'one minute'))
9+
.addArgument(
10+
new commander.Argument('<drink-size>', 'drink cup size').choices([
11+
'small',
12+
'medium',
13+
'large',
14+
]),
15+
)
16+
.addArgument(
17+
new commander.Argument('[timeout]', 'timeout in seconds').default(
18+
60,
19+
'one minute',
20+
),
21+
)
1122
.action((drinkSize, timeout) => {
1223
console.log(`Drink size: ${drinkSize}`);
1324
console.log(`Timeout (s): ${timeout}`);

examples/configure-help.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ const program = new commander.Command();
88

99
program.configureHelp({
1010
sortSubcommands: true,
11-
subcommandTerm: (cmd) => cmd.name() // Just show the name, instead of short usage.
11+
subcommandTerm: (cmd) => cmd.name(), // Just show the name, instead of short usage.
1212
});
1313

14-
program.command('zebra <herd-size>', 'African equines with distinctive black-and-white striped coats');
15-
program.command('aardvark [colour]', 'medium-sized, burrowing, nocturnal mammal');
14+
program.command(
15+
'zebra <herd-size>',
16+
'African equines with distinctive black-and-white striped coats',
17+
);
18+
program.command(
19+
'aardvark [colour]',
20+
'medium-sized, burrowing, nocturnal mammal',
21+
);
1622
program
1723
.command('beaver', 'large, semiaquatic rodent')
1824
.option('--pond')

examples/configure-output.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,15 @@ function errorColor(str) {
66
return `\x1b[31m${str}\x1b[0m`;
77
}
88

9-
program
10-
.configureOutput({
11-
// Visibly override write routines as example!
12-
writeOut: (str) => process.stdout.write(`[OUT] ${str}`),
13-
writeErr: (str) => process.stdout.write(`[ERR] ${str}`),
14-
// Output errors in red.
15-
outputError: (str, write) => write(errorColor(str))
16-
});
9+
program.configureOutput({
10+
// Visibly override write routines as example!
11+
writeOut: (str) => process.stdout.write(`[OUT] ${str}`),
12+
writeErr: (str) => process.stdout.write(`[ERR] ${str}`),
13+
// Output errors in red.
14+
outputError: (str, write) => write(errorColor(str)),
15+
});
1716

18-
program
19-
.version('1.2.3')
20-
.option('-c, --compress')
21-
.command('sub-command');
17+
program.version('1.2.3').option('-c, --compress').command('sub-command');
2218

2319
program.parse();
2420

examples/custom-command-class.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ program
3232
inpectCommand(command);
3333
});
3434

35-
program
36-
.command('build <target>')
37-
.action((buildTarget, options, command) => {
38-
inpectCommand(command);
39-
});
35+
program.command('build <target>').action((buildTarget, options, command) => {
36+
inpectCommand(command);
37+
});
4038

4139
program.parse();
4240

examples/custom-help

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
const { Command } = require('commander');
77
const program = new Command();
88

9-
program
10-
.option('-f, --foo', 'enable some foo');
9+
program.option('-f, --foo', 'enable some foo');
1110

12-
program.addHelpText('after', `
11+
program.addHelpText(
12+
'after',
13+
`
1314
1415
Example call:
15-
$ custom-help --help`);
16+
$ custom-help --help`,
17+
);
1618

1719
program.parse(process.argv);
1820

examples/custom-help-text.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ program
1919
program
2020
.command('extra')
2121
.addHelpText('before', 'Note: the extra command does not do anything')
22-
.addHelpText('after', `
22+
.addHelpText(
23+
'after',
24+
`
2325
Examples:
2426
awesome extra --help
25-
awesome help extra`);
27+
awesome help extra`,
28+
);
2629

2730
program.parse();
2831

examples/deploy

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,19 @@ program
2525
.option('-e, --exec_mode <mode>', 'Which exec mode to use', 'fast')
2626
.action((script, options) => {
2727
console.log('read config from %s', program.opts().config);
28-
console.log('exec "%s" using %s mode and config %s', script, options.exec_mode, program.opts().config);
29-
}).addHelpText('after', `
28+
console.log(
29+
'exec "%s" using %s mode and config %s',
30+
script,
31+
options.exec_mode,
32+
program.opts().config,
33+
);
34+
})
35+
.addHelpText(
36+
'after',
37+
`
3038
Examples:
3139
$ deploy exec sequential
32-
$ deploy exec async`
40+
$ deploy exec async`,
3341
);
34-
42+
3543
program.parse(process.argv);

0 commit comments

Comments
 (0)