MCPcopy Create free account
hub / github.com/conventional-changelog/commitlint / lintMessage

Function lintMessage

@commitlint/config-angular/index.test.js:8–22  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

6const { rules, parserPreset } = config;
7
8const lintMessage = async (message) => {
9 const parserOpts = parserPreset.parserOpts;
10 const m = message.replace(/^\s+/, "").trim();
11 const result = await lint(m, rules, { parserOpts });
12
13 if (result.errors.length > 1) {
14 throw new Error("Commit test should only have one error message to validate against");
15 }
16
17 if (result.warnings.length > 1) {
18 throw new Error("Commit test should only have one warning message to validate against");
19 }
20
21 return result;
22};
23
24test("a valid commit message", async () => {
25 const result = await lintMessage("test: a valid angular commit");

Callers 1

index.test.jsFile · 0.85

Calls 1

lintFunction · 0.50

Tested by

no test coverage detected