From aa5d1bce74b5db8328a10b4a65c0b4ac94f005b0 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 12 Dec 2018 19:00:45 +0100 Subject: [PATCH 1/3] fix(cli): cleanup message for input with no config --- @commitlint/cli/src/cli.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/@commitlint/cli/src/cli.js b/@commitlint/cli/src/cli.js index 8109af9997..0d498cbaae 100755 --- a/@commitlint/cli/src/cli.js +++ b/@commitlint/cli/src/cli.js @@ -151,6 +151,14 @@ async function main(options) { ); if (Object.keys(loaded.rules).length === 0) { + let input = ''; + + if (results.length !== 0) { + const originalInput = results[0].input; + input = originalInput; + results.pop(); + } + results.push({ valid: false, errors: [ @@ -166,7 +174,7 @@ async function main(options) { } ], warnings: [], - input: '' + input }); } From fa0d78d7104555cdfce2e1d1e86a0d9e59aaf82d Mon Sep 17 00:00:00 2001 From: escapedcat Date: Sun, 16 Dec 2018 19:00:20 +0100 Subject: [PATCH 2/3] chore(format): remove linebreaks from output this let to too many linebreaks in certain situations --- @commitlint/format/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/@commitlint/format/src/index.js b/@commitlint/format/src/index.js index 81ff37f00e..2ca04d6a3b 100644 --- a/@commitlint/format/src/index.js +++ b/@commitlint/format/src/index.js @@ -31,7 +31,7 @@ function formatInput(result = {}, options = {}) { const sign = '⧗'; const decoration = enabled ? chalk.gray(sign) : sign; - const commitText = errors.length > 0 ? `\n${input}\n` : input.split('\n')[0]; + const commitText = errors.length > 0 ? input : input.split('\n')[0]; const decoratedInput = enabled ? chalk.bold(commitText) : commitText; From 1e1ab06b0d5b1785fab4df48681bd62869e9377f Mon Sep 17 00:00:00 2001 From: escapedcat Date: Wed, 19 Dec 2018 18:05:21 +0100 Subject: [PATCH 3/3] refactor(cli): empty results on no-config --- @commitlint/cli/src/cli.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/@commitlint/cli/src/cli.js b/@commitlint/cli/src/cli.js index 0d498cbaae..cadc49f557 100755 --- a/@commitlint/cli/src/cli.js +++ b/@commitlint/cli/src/cli.js @@ -156,10 +156,9 @@ async function main(options) { if (results.length !== 0) { const originalInput = results[0].input; input = originalInput; - results.pop(); } - results.push({ + results.splice(0, results.length, { valid: false, errors: [ {