From 5f12534693b66976abd74e9ce3f6561b2b013c80 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 11 Sep 2024 12:59:04 +0800 Subject: [PATCH 1/6] feat(cli): use special errorCode for missing rules/config #4142 --- @commitlint/cli/src/cli.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index a74e18a98b..7b1d40aa2e 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -316,6 +316,7 @@ async function main(args: MainArgs): Promise { messages.map((message) => lint(message, loaded.rules, opts)) ); + let isRulesEmpty = false; if (Object.keys(loaded.rules).length === 0) { let input = ''; @@ -340,6 +341,8 @@ async function main(args: MainArgs): Promise { warnings: [], input, }); + + isRulesEmpty = true; } const report = results.reduce<{ @@ -387,6 +390,9 @@ async function main(args: MainArgs): Promise { if (!report.valid) { throw new CliError(output, pkg.name); } + if (!report.valid && isRulesEmpty) { + throw new CliError(output, pkg.name, 6); + } } function checkFromStdin(input: (string | number)[], flags: CliFlags): boolean { From 39c66fb292649a926917580dcaa89391fac2c8e6 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 11 Sep 2024 13:05:45 +0800 Subject: [PATCH 2/6] test(cli): update related tests #4142 --- @commitlint/cli/src/cli.test.ts | 4 ++-- @commitlint/cli/src/cli.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/@commitlint/cli/src/cli.test.ts b/@commitlint/cli/src/cli.test.ts index f045b1c856..30d522677b 100644 --- a/@commitlint/cli/src/cli.test.ts +++ b/@commitlint/cli/src/cli.test.ts @@ -107,7 +107,7 @@ test('should produce help for empty config', async () => { const result = cli([], {cwd})('foo: bar'); const output = await result; expect(output.stdout.trim()).toContain('Please add rules'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(6); }); test('should produce help for problems', async () => { @@ -137,7 +137,7 @@ test('should fail for input from stdin without rules', async () => { const cwd = await gitBootstrap('fixtures/empty'); const result = cli([], {cwd})('foo: bar'); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(6); }); test('should succeed for input from stdin with rules', async () => { diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index 7b1d40aa2e..35f7402b5e 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -387,12 +387,12 @@ async function main(args: MainArgs): Promise { throw new CliError(output, pkg.name, 2); } } - if (!report.valid) { - throw new CliError(output, pkg.name); - } if (!report.valid && isRulesEmpty) { throw new CliError(output, pkg.name, 6); } + if (!report.valid) { + throw new CliError(output, pkg.name); + } } function checkFromStdin(input: (string | number)[], flags: CliFlags): boolean { From f5a8fc9fc8c4459b251a2f260bcc38690934a649 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 11 Sep 2024 13:11:13 +0800 Subject: [PATCH 3/6] feat(cli): use errorCode 9 #4142 --- @commitlint/cli/src/cli.test.ts | 4 ++-- @commitlint/cli/src/cli.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/@commitlint/cli/src/cli.test.ts b/@commitlint/cli/src/cli.test.ts index 30d522677b..2c6e18c28d 100644 --- a/@commitlint/cli/src/cli.test.ts +++ b/@commitlint/cli/src/cli.test.ts @@ -107,7 +107,7 @@ test('should produce help for empty config', async () => { const result = cli([], {cwd})('foo: bar'); const output = await result; expect(output.stdout.trim()).toContain('Please add rules'); - expect(result.exitCode).toBe(6); + expect(result.exitCode).toBe(9); }); test('should produce help for problems', async () => { @@ -137,7 +137,7 @@ test('should fail for input from stdin without rules', async () => { const cwd = await gitBootstrap('fixtures/empty'); const result = cli([], {cwd})('foo: bar'); await result; - expect(result.exitCode).toBe(6); + expect(result.exitCode).toBe(9); }); test('should succeed for input from stdin with rules', async () => { diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index 35f7402b5e..2f3413142c 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -388,7 +388,7 @@ async function main(args: MainArgs): Promise { } } if (!report.valid && isRulesEmpty) { - throw new CliError(output, pkg.name, 6); + throw new CliError(output, pkg.name, 9); } if (!report.valid) { throw new CliError(output, pkg.name); From e2ee3d916474b512576f1d118dafe784abb5adab Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 11 Sep 2024 14:05:12 +0800 Subject: [PATCH 4/6] refactor(cli): shorten statement #4142 --- @commitlint/cli/src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index 2f3413142c..66b0ee0b81 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -387,7 +387,7 @@ async function main(args: MainArgs): Promise { throw new CliError(output, pkg.name, 2); } } - if (!report.valid && isRulesEmpty) { + if (isRulesEmpty) { throw new CliError(output, pkg.name, 9); } if (!report.valid) { From 4fcbbfe2903b91e637eb0c79cb9110bbef302074 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 11 Sep 2024 14:15:07 +0800 Subject: [PATCH 5/6] refactor(cli): use ExitCode Enum #4142 --- @commitlint/cli/src/cli-error.ts | 19 +++++++++++++++++-- @commitlint/cli/src/cli.ts | 12 ++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/@commitlint/cli/src/cli-error.ts b/@commitlint/cli/src/cli-error.ts index eb1c985179..9838a375de 100644 --- a/@commitlint/cli/src/cli-error.ts +++ b/@commitlint/cli/src/cli-error.ts @@ -1,10 +1,25 @@ +export enum ExitCode { + Normal = 0, + UncaughtFatalException = 1, + ReservedByBash = 2, + InternalJavaScriptParseError = 3, + InternalJavaScriptEvaluationFailure = 4, + FatalError = 5, + NonFunctionInternalExceptionHandler = 6, + InvalidArgument = 9, +} + export class CliError extends Error { __proto__ = Error; public type: string; - public error_code: number; + public error_code: ExitCode; - constructor(message: string, type: string, error_code = 1) { + constructor( + message: string, + type: string, + error_code = ExitCode.UncaughtFatalException + ) { super(message); this.type = type; diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index 66b0ee0b81..902327699d 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -20,7 +20,7 @@ import yargs, {type Arguments} from 'yargs'; import {CliFlags} from './types.js'; -import {CliError} from './cli-error.js'; +import {CliError, ExitCode} from './cli-error.js'; const require = createRequire(import.meta.url); @@ -381,14 +381,18 @@ async function main(args: MainArgs): Promise { if (flags.strict) { if (report.errorCount > 0) { - throw new CliError(output, pkg.name, 3); + throw new CliError( + output, + pkg.name, + ExitCode.InternalJavaScriptParseError + ); } if (report.warningCount > 0) { - throw new CliError(output, pkg.name, 2); + throw new CliError(output, pkg.name, ExitCode.ReservedByBash); } } if (isRulesEmpty) { - throw new CliError(output, pkg.name, 9); + throw new CliError(output, pkg.name, ExitCode.InvalidArgument); } if (!report.valid) { throw new CliError(output, pkg.name); From c1943054031c81845fa9bfe5c3f0e782d6ee2923 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 11 Sep 2024 15:01:22 +0800 Subject: [PATCH 6/6] refactor(cli): rename ExitCode-enum to match commitlints usage #4142 --- @commitlint/cli/src/cli-error.ts | 15 +++--- @commitlint/cli/src/cli.test.ts | 80 ++++++++++++++++---------------- @commitlint/cli/src/cli.ts | 10 ++-- 3 files changed, 49 insertions(+), 56 deletions(-) diff --git a/@commitlint/cli/src/cli-error.ts b/@commitlint/cli/src/cli-error.ts index 9838a375de..69db5917bc 100644 --- a/@commitlint/cli/src/cli-error.ts +++ b/@commitlint/cli/src/cli-error.ts @@ -1,12 +1,9 @@ export enum ExitCode { - Normal = 0, - UncaughtFatalException = 1, - ReservedByBash = 2, - InternalJavaScriptParseError = 3, - InternalJavaScriptEvaluationFailure = 4, - FatalError = 5, - NonFunctionInternalExceptionHandler = 6, - InvalidArgument = 9, + CommitlintDefault = 0, + CommitlintErrorDefault = 1, + CommitLintWarning = 2, + CommitLintError = 3, + CommitlintInvalidArgument = 9, } export class CliError extends Error { @@ -18,7 +15,7 @@ export class CliError extends Error { constructor( message: string, type: string, - error_code = ExitCode.UncaughtFatalException + error_code = ExitCode.CommitlintErrorDefault ) { super(message); diff --git a/@commitlint/cli/src/cli.test.ts b/@commitlint/cli/src/cli.test.ts index 2c6e18c28d..d6a8c66ba7 100644 --- a/@commitlint/cli/src/cli.test.ts +++ b/@commitlint/cli/src/cli.test.ts @@ -2,11 +2,11 @@ import {describe, test, expect} from 'vitest'; import {createRequire} from 'module'; import path from 'path'; import {fileURLToPath} from 'url'; - import {fix, git} from '@commitlint/test'; import fs from 'fs-extra'; import merge from 'lodash.merge'; import {x} from 'tinyexec'; +import {ExitCode} from './cli-error.js'; const require = createRequire(import.meta.url); @@ -42,7 +42,7 @@ test('should throw when called without [input]', async () => { const cwd = await gitBootstrap('fixtures/default'); const result = cli([], {cwd})(); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should reprint input from stdin', async () => { @@ -107,7 +107,7 @@ test('should produce help for empty config', async () => { const result = cli([], {cwd})('foo: bar'); const output = await result; expect(output.stdout.trim()).toContain('Please add rules'); - expect(result.exitCode).toBe(9); + expect(result.exitCode).toBe(ExitCode.CommitlintInvalidArgument); }); test('should produce help for problems', async () => { @@ -117,7 +117,7 @@ test('should produce help for problems', async () => { expect(output.stdout.trim()).toContain( 'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint' ); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should produce help for problems with correct helpurl', async () => { @@ -130,21 +130,21 @@ test('should produce help for problems with correct helpurl', async () => { expect(output.stdout.trim()).toContain( 'Get help: https://github.com/conventional-changelog/commitlint/#testhelpurl' ); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should fail for input from stdin without rules', async () => { const cwd = await gitBootstrap('fixtures/empty'); const result = cli([], {cwd})('foo: bar'); await result; - expect(result.exitCode).toBe(9); + expect(result.exitCode).toBe(ExitCode.CommitlintInvalidArgument); }); test('should succeed for input from stdin with rules', async () => { const cwd = await gitBootstrap('fixtures/default'); const result = cli([], {cwd})('type: bar'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should fail for input from stdin with rule from rc', async () => { @@ -152,7 +152,7 @@ test('should fail for input from stdin with rule from rc', async () => { const result = cli([], {cwd})('foo: bar'); const output = await result; expect(output.stdout.trim()).toContain('type must not be one of [foo]'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should work with --config option', async () => { @@ -161,7 +161,7 @@ test('should work with --config option', async () => { const result = cli(['--config', file], {cwd})('foo: bar'); const output = await result; expect(output.stdout.trim()).toContain('type must not be one of [foo]'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should fail for input from stdin with rule from js', async () => { @@ -169,7 +169,7 @@ test('should fail for input from stdin with rule from js', async () => { const result = cli(['--extends', './extended'], {cwd})('foo: bar'); const output = await result; expect(output.stdout.trim()).toContain('type must not be one of [foo]'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should output help URL defined in config file', async () => { @@ -179,7 +179,7 @@ test('should output help URL defined in config file', async () => { expect(output.stdout.trim()).toContain( 'Get help: https://www.example.com/foo' ); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should produce no error output with --quiet flag', async () => { @@ -188,7 +188,7 @@ test('should produce no error output with --quiet flag', async () => { const output = await result; expect(output.stdout.trim()).toEqual(''); expect(output.stderr).toEqual(''); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should produce no error output with -q flag', async () => { @@ -197,7 +197,7 @@ test('should produce no error output with -q flag', async () => { const output = await result; expect(output.stdout.trim()).toEqual(''); expect(output.stderr).toEqual(''); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should work with husky commitmsg hook and git commit', async () => { @@ -294,7 +294,7 @@ test('should allow reading of environment variables for edit file, succeeding if env: {variable: 'commit-msg-file'}, })(); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should allow reading of environment variables for edit file, failing if invalid', async () => { @@ -308,7 +308,7 @@ test('should allow reading of environment variables for edit file, failing if in env: {variable: 'commit-msg-file'}, })(); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should pick up parser preset and fail accordingly', async () => { @@ -318,7 +318,7 @@ test('should pick up parser preset and fail accordingly', async () => { ); const output = await result; expect(output.stdout.trim()).toContain('may not be empty'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should pick up parser preset and succeed accordingly', async () => { @@ -327,7 +327,7 @@ test('should pick up parser preset and succeed accordingly', async () => { '----type(scope): subject' ); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should pick up config from outside git repo and fail accordingly', async () => { @@ -336,7 +336,7 @@ test('should pick up config from outside git repo and fail accordingly', async ( const result = cli([], {cwd})('inner: bar'); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should pick up config from outside git repo and succeed accordingly', async () => { @@ -345,7 +345,7 @@ test('should pick up config from outside git repo and succeed accordingly', asyn const result = cli([], {cwd})('outer: bar'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should pick up config from inside git repo with precedence and succeed accordingly', async () => { @@ -354,7 +354,7 @@ test('should pick up config from inside git repo with precedence and succeed acc const result = cli([], {cwd})('inner: bar'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should pick up config from inside git repo with precedence and fail accordingly', async () => { @@ -363,7 +363,7 @@ test('should pick up config from inside git repo with precedence and fail accord const result = cli([], {cwd})('outer: bar'); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should handle --amend with signoff', async () => { @@ -389,7 +389,7 @@ test('it uses parserOpts.commentChar when not using edit mode', async () => { const result = cli([], {cwd})(input); const output = await result; expect(output.stdout.trim()).toContain('[body-empty]'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test("it doesn't use parserOpts.commentChar when using edit mode", async () => { @@ -402,7 +402,7 @@ test("it doesn't use parserOpts.commentChar when using edit mode", async () => { const result = cli(['--edit', '.git/COMMIT_EDITMSG'], {cwd})(); const output = await result; expect(output.stdout.trim()).not.toContain('[body-empty]'); - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('it uses core.commentChar git config when using edit mode', async () => { @@ -418,7 +418,7 @@ test('it uses core.commentChar git config when using edit mode', async () => { const result = cli(['--edit', '.git/COMMIT_EDITMSG'], {cwd})(); const output = await result; expect(output.stdout.trim()).toContain('[body-empty]'); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('it falls back to # for core.commentChar when using edit mode', async () => { @@ -432,14 +432,14 @@ test('it falls back to # for core.commentChar when using edit mode', async () => const output = await result; expect(output.stdout.trim()).toContain('[body-empty]'); expect(output.stderr).toEqual(''); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should handle linting with issue prefixes', async () => { const cwd = await gitBootstrap('fixtures/issue-prefixes'); const result = cli([], {cwd})('foobar REF-1'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }, 10000); test('should print full commit message when input from stdin fails', async () => { @@ -449,7 +449,7 @@ test('should print full commit message when input from stdin fails', async () => const result = cli(['--color=false'], {cwd})(input); const output = await result; expect(output.stdout.trim()).toContain(input); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should not print commit message fully or partially when input succeeds', async () => { @@ -460,7 +460,7 @@ test('should not print commit message fully or partially when input succeeds', a const output = await result; expect(output.stdout.trim()).not.toContain(message); expect(output.stdout.trim()).not.toContain(message.split('\n')[0]); - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should fail for invalid formatters from configuration', async () => { @@ -471,42 +471,42 @@ test('should fail for invalid formatters from configuration', async () => { 'Using format custom-formatter, but cannot find the module' ); expect(output.stdout.trim()).toEqual(''); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should skip linting if message matches ignores config', async () => { const cwd = await gitBootstrap('fixtures/ignores'); const result = cli([], {cwd})('WIP'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should not skip linting if message does not match ignores config', async () => { const cwd = await gitBootstrap('fixtures/ignores'); const result = cli([], {cwd})('foo'); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should not skip linting if defaultIgnores is false', async () => { const cwd = await gitBootstrap('fixtures/default-ignores-false'); const result = cli([], {cwd})('fixup! foo: bar'); await result; - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should skip linting if defaultIgnores is true', async () => { const cwd = await gitBootstrap('fixtures/default-ignores-true'); const result = cli([], {cwd})('fixup! foo: bar'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should skip linting if defaultIgnores is unset', async () => { const cwd = await gitBootstrap('fixtures/default-ignores-unset'); const result = cli([], {cwd})('fixup! foo: bar'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should fail for invalid formatters from flags', async () => { @@ -517,7 +517,7 @@ test('should fail for invalid formatters from flags', async () => { 'Using format through-flag, but cannot find the module' ); expect(output.stdout.trim()).toEqual(''); - expect(result.exitCode).toBe(1); + expect(result.exitCode).toBe(ExitCode.CommitlintErrorDefault); }); test('should work with absolute formatter path', async () => { @@ -531,7 +531,7 @@ test('should work with absolute formatter path', async () => { ); const output = await result; expect(output.stdout.trim()).toContain('custom-formatter-ok'); - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should work with relative formatter path', async () => { @@ -544,28 +544,28 @@ test('should work with relative formatter path', async () => { ); const output = await result; expect(output.stdout.trim()).toContain('custom-formatter-ok'); - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('strict: should exit with 3 on error', async () => { const cwd = await gitBootstrap('fixtures/warning'); const result = cli(['--strict'], {cwd})('foo: abcdef'); await result; - expect(result.exitCode).toBe(3); + expect(result.exitCode).toBe(ExitCode.CommitLintError); }); test('strict: should exit with 2 on warning', async () => { const cwd = await gitBootstrap('fixtures/warning'); const result = cli(['--strict'], {cwd})('feat: abcdef'); await result; - expect(result.exitCode).toBe(2); + expect(result.exitCode).toBe(ExitCode.CommitLintWarning); }); test('strict: should exit with 0 on success', async () => { const cwd = await gitBootstrap('fixtures/warning'); const result = cli(['--strict'], {cwd})('feat: abc'); await result; - expect(result.exitCode).toBe(0); + expect(result.exitCode).toBe(ExitCode.CommitlintDefault); }); test('should print help', async () => { diff --git a/@commitlint/cli/src/cli.ts b/@commitlint/cli/src/cli.ts index 902327699d..421eeb692b 100644 --- a/@commitlint/cli/src/cli.ts +++ b/@commitlint/cli/src/cli.ts @@ -381,18 +381,14 @@ async function main(args: MainArgs): Promise { if (flags.strict) { if (report.errorCount > 0) { - throw new CliError( - output, - pkg.name, - ExitCode.InternalJavaScriptParseError - ); + throw new CliError(output, pkg.name, ExitCode.CommitLintError); } if (report.warningCount > 0) { - throw new CliError(output, pkg.name, ExitCode.ReservedByBash); + throw new CliError(output, pkg.name, ExitCode.CommitLintWarning); } } if (isRulesEmpty) { - throw new CliError(output, pkg.name, ExitCode.InvalidArgument); + throw new CliError(output, pkg.name, ExitCode.CommitlintInvalidArgument); } if (!report.valid) { throw new CliError(output, pkg.name);