From 1bdc749ac0c424bac94c9645dcfa3a4455a9c0c8 Mon Sep 17 00:00:00 2001 From: John Gee Date: Fri, 5 Apr 2024 20:15:54 +1300 Subject: [PATCH] Reformat code with Prettier (#2180) --- eslint.config.js | 28 +- esm.mjs | 2 +- examples/action-this.js | 2 +- examples/arguments-extra.js | 15 +- examples/configure-help.js | 12 +- examples/configure-output.js | 20 +- examples/custom-command-class.js | 8 +- examples/custom-help | 10 +- examples/custom-help-text.js | 7 +- examples/deploy | 16 +- examples/global-options-added.js | 6 +- examples/global-options-nested.js | 6 +- examples/help-subcommands-usage.js | 15 +- examples/hook.js | 17 +- examples/nestedCommands.js | 32 +- examples/options-boolean-or-value.js | 3 +- examples/options-conflicts.js | 46 +- examples/options-custom-processing.js | 10 +- examples/options-defaults.js | 7 +- examples/options-env.js | 22 +- examples/options-extra.js | 31 +- examples/options-implies.js | 19 +- examples/options-negatable.js | 3 +- examples/options-required.js | 3 +- examples/pizza | 4 +- examples/pm | 10 +- examples/pm-install | 5 +- examples/positional-options.js | 4 +- examples/split.js | 4 +- examples/string-util.js | 6 +- jest.config.js | 6 +- lib/argument.js | 8 +- lib/command.js | 470 ++++++++++++------ lib/help.js | 131 +++-- lib/option.js | 11 +- lib/suggestSimilar.js | 9 +- tests/args.variadic.test.js | 27 +- tests/argument.chain.test.js | 2 +- tests/argument.choices.test.js | 8 +- tests/argument.custom-processing.test.js | 64 +-- tests/argument.variadic.test.js | 36 +- tests/command.action.test.js | 143 +++--- tests/command.addCommand.test.js | 7 +- tests/command.addHelpOption.test.js | 19 +- tests/command.addHelpText.test.js | 53 +- tests/command.alias.test.js | 37 +- tests/command.allowExcessArguments.test.js | 233 ++++----- tests/command.allowUnknownOption.test.js | 12 +- tests/command.argumentVariations.test.js | 169 ++++--- tests/command.asterisk.test.js | 64 +-- tests/command.chain.test.js | 8 +- tests/command.commandHelp.test.js | 6 +- tests/command.configureHelp.test.js | 14 +- tests/command.configureOutput.test.js | 126 +++-- tests/command.default.test.js | 15 +- tests/command.error.test.js | 21 +- ...mmand.executableSubcommand.inspect.test.js | 58 ++- ...ommand.executableSubcommand.lookup.test.js | 52 +- .../command.executableSubcommand.mock.test.js | 18 +- ...ommand.executableSubcommand.search.test.js | 140 ++++-- ...mmand.executableSubcommand.signals.test.js | 52 +- tests/command.executableSubcommand.test.js | 8 +- tests/command.exitOverride.test.js | 185 ++++--- tests/command.help.test.js | 139 +++--- tests/command.helpCommand.test.js | 41 +- tests/command.helpOption.test.js | 51 +- tests/command.hook.test.js | 184 ++++--- tests/command.name.test.js | 7 +- tests/command.nested.test.js | 5 +- tests/command.onCommand.test.js | 11 +- tests/command.option-misuse.test.js | 3 +- tests/command.parse.test.js | 14 +- tests/command.parseOptions.test.js | 47 +- tests/command.positionalOptions.test.js | 128 +++-- tests/command.showHelpAfterError.test.js | 7 +- .../command.showSuggestionAfterError.test.js | 14 +- tests/command.unknownCommand.test.js | 27 +- tests/command.unknownOption.test.js | 10 +- tests/command.usage.test.js | 27 +- tests/commander.configureCommand.test.js | 25 +- tests/deprecated.test.js | 9 +- tests/esm-imports-test.mjs | 14 +- tests/fixtures/inspect.js | 4 +- tests/fixtures/pm | 41 +- tests/fixtures/pm-listen | 12 +- tests/help.argumentDescription.test.js | 21 +- tests/help.commandTerm.test.js | 13 +- tests/help.commandUsage.test.js | 14 +- tests/help.longestArgumentTermLength.test.js | 8 +- tests/help.longestCommandTermLength.test.js | 27 +- tests/help.longestOptionTermLength.test.js | 8 +- tests/help.optionDescription.test.js | 29 +- tests/help.padWidth.test.js | 24 +- tests/help.showGlobalOptions.test.js | 22 +- tests/help.sortCommands.test.js | 8 +- tests/help.sortOptions.test.js | 24 +- tests/help.suggestion.test.js | 99 ++-- tests/help.visibleArguments.test.js | 20 +- tests/help.visibleCommands.test.js | 14 +- tests/help.visibleGlobalOptions.test.js | 30 +- tests/help.visibleOptions.test.js | 12 +- tests/help.wrap.test.js | 46 +- tests/incrementNodeInspectorPort.test.js | 6 +- tests/option.chain.test.js | 2 +- tests/options.bool.combo.test.js | 6 +- tests/options.bool.test.js | 40 +- tests/options.camelcase.test.js | 18 +- tests/options.choices.test.js | 12 +- tests/options.conflicts.test.js | 72 ++- tests/options.custom-processing.test.js | 52 +- tests/options.dual-options.test.js | 12 +- tests/options.env.test.js | 187 ++++--- tests/options.flags.test.js | 30 +- tests/options.getset.test.js | 54 +- tests/options.implies.test.js | 35 +- tests/options.mandatory.test.js | 39 +- tests/options.optional.test.js | 25 +- tests/options.opts.test.js | 96 ++-- tests/options.optsWithGlobals.test.js | 29 +- tests/options.preset.test.js | 4 +- tests/options.registerClash.test.js | 9 +- tests/options.required.test.js | 18 +- tests/options.values.test.js | 18 +- tests/options.variadic.test.js | 59 +-- tests/options.version.test.js | 15 +- tests/program.test.js | 5 +- tests/ts-imports.test.ts | 14 +- tsconfig.js.json | 7 +- tsconfig.json | 25 +- tsconfig.ts.json | 7 +- typings/index.d.ts | 108 +++- typings/index.test-d.ts | 388 +++++++++++---- 132 files changed, 3056 insertions(+), 2160 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index ef0c187dd..79a37bd19 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -14,20 +14,17 @@ const tseslintConfigs = tseslint.config( languageOptions: { parserOptions: { project: './tsconfig.js.json' }, }, - extends: [ - ...tseslint.configs.recommended, - ], + extends: [...tseslint.configs.recommended], rules: { '@typescript-eslint/no-var-requires': 'off', // (tseslint does not autodetect commonjs context ) }, - }, { + }, + { files: tsconfigTsFiles, languageOptions: { parserOptions: { project: './tsconfig.ts.json' }, }, - extends: [ - ...tseslint.configs.recommended, - ], + extends: [...tseslint.configs.recommended], }, ); @@ -59,17 +56,20 @@ module.exports = [ files: ['**/*.test.{js,mjs,cjs}'], rules: { 'no-unused-vars': 'off', // lots in tests, minimise churn for now - } + }, }, { files: [...tsconfigTsFiles, ...tsconfigJsFiles], rules: { - '@typescript-eslint/ban-ts-comment': ['error', { - 'ts-expect-error': 'allow-with-description', - 'ts-ignore': 'allow-with-description', - 'ts-nocheck': true, - 'ts-check': true, - }], + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': 'allow-with-description', + 'ts-nocheck': true, + 'ts-check': true, + }, + ], }, }, ]; diff --git a/esm.mjs b/esm.mjs index e7190a1b8..796ec3a58 100644 --- a/esm.mjs +++ b/esm.mjs @@ -12,5 +12,5 @@ export const { Command, Argument, Option, - Help + Help, } = commander; diff --git a/examples/action-this.js b/examples/action-this.js index 9229ce3b1..d6ac722ee 100644 --- a/examples/action-this.js +++ b/examples/action-this.js @@ -9,7 +9,7 @@ program .command('serve') .argument('