Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): cleanup message for input with no config #519

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion @commitlint/cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
escapedcat marked this conversation as resolved.
Show resolved Hide resolved
input = originalInput;
results.pop();
}

results.push({
valid: false,
errors: [
Expand All @@ -166,7 +174,7 @@ async function main(options) {
}
],
warnings: [],
input: ''
input
});
}

Expand Down
2 changes: 1 addition & 1 deletion @commitlint/format/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
escapedcat marked this conversation as resolved.
Show resolved Hide resolved

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

Expand Down