Skip to content

Commit 7d9e760

Browse files
escapedcatmarionebl
authored andcommitted
fix: cleanup message for input with no config (#519)
* fix(cli): cleanup message for input with no config * chore(format): remove linebreaks from output this let to too many linebreaks in certain situations * refactor(cli): empty results on no-config
1 parent 83b1a47 commit 7d9e760

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

@commitlint/cli/src/cli.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ async function main(options) {
151151
);
152152

153153
if (Object.keys(loaded.rules).length === 0) {
154-
results.push({
154+
let input = '';
155+
156+
if (results.length !== 0) {
157+
const originalInput = results[0].input;
158+
input = originalInput;
159+
}
160+
161+
results.splice(0, results.length, {
155162
valid: false,
156163
errors: [
157164
{
@@ -166,7 +173,7 @@ async function main(options) {
166173
}
167174
],
168175
warnings: [],
169-
input: ''
176+
input
170177
});
171178
}
172179

@commitlint/format/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function formatInput(result = {}, options = {}) {
3131

3232
const sign = '⧗';
3333
const decoration = enabled ? chalk.gray(sign) : sign;
34-
const commitText = errors.length > 0 ? `\n${input}\n` : input.split('\n')[0];
34+
const commitText = errors.length > 0 ? input : input.split('\n')[0];
3535

3636
const decoratedInput = enabled ? chalk.bold(commitText) : commitText;
3737

0 commit comments

Comments
 (0)