diff --git a/@commitlint/cli/src/cli.js b/@commitlint/cli/src/cli.js index 8109af9997..cadc49f557 100755 --- a/@commitlint/cli/src/cli.js +++ b/@commitlint/cli/src/cli.js @@ -151,7 +151,14 @@ async function main(options) { ); if (Object.keys(loaded.rules).length === 0) { - results.push({ + let input = ''; + + if (results.length !== 0) { + const originalInput = results[0].input; + input = originalInput; + } + + results.splice(0, results.length, { valid: false, errors: [ { @@ -166,7 +173,7 @@ async function main(options) { } ], warnings: [], - input: '' + input }); } diff --git a/@commitlint/format/src/index.js b/@commitlint/format/src/index.js index 1a1daa89c5..8980f95731 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;