Skip to content
Merged
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions @commitlint/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ async function main(args: MainArgs): Promise<void> {
messages.map((message) => lint(message, loaded.rules, opts))
);

let isRulesEmpty = false;
if (Object.keys(loaded.rules).length === 0) {
let input = '';

Expand All @@ -340,6 +341,8 @@ async function main(args: MainArgs): Promise<void> {
warnings: [],
input,
});

isRulesEmpty = true;
}

const report = results.reduce<{
Expand Down Expand Up @@ -387,6 +390,9 @@ async function main(args: MainArgs): Promise<void> {
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 {
Expand Down