Skip to content

Commit 14d47e5

Browse files
committed
refactor(lint): rewrite missing rule error message
1 parent f532fb2 commit 14d47e5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

@commitlint/lint/src/lint.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ test('throws for invalid rule names', async () => {
9393
bar: [RuleConfigSeverity.Warning, 'never'],
9494
});
9595

96-
await expect(error).rejects.toThrow(/^Found invalid rule names: foo, bar/);
96+
await expect(error).rejects.toThrow(
97+
/^Found rules without implementation: foo, bar/
98+
);
9799
});
98100

99101
test('throws for invalid rule config', async () => {

@commitlint/lint/src/lint.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ export default async function lint(
7979
if (missing.length > 0) {
8080
const names = [...allRules.keys()];
8181
throw new RangeError(
82-
`Found invalid rule names: ${missing.join(
83-
', '
84-
)}. Supported rule names are: ${names.join(', ')}`
82+
[
83+
`Found rules without implementation: ${missing.join(', ')}.`,
84+
`Supported rules are: ${names.join(', ')}.`,
85+
].join('\n')
8586
);
8687
}
8788

0 commit comments

Comments
 (0)