1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.footerLeadingBlank = void 0;
|
7 | const to_lines_1 = __importDefault(require("@commitlint/to-lines"));
|
8 | const message_1 = __importDefault(require("@commitlint/message"));
|
9 | const footerLeadingBlank = (parsed, when = 'always') => {
|
10 |
|
11 | if (!parsed.footer) {
|
12 | return [true];
|
13 | }
|
14 | const negated = when === 'never';
|
15 | const rawLines = to_lines_1.default(parsed.raw);
|
16 | const bodyLines = parsed.body ? to_lines_1.default(parsed.body) : [];
|
17 | const bodyOffset = bodyLines.length > 0 ? rawLines.indexOf(bodyLines[0]) : 1;
|
18 | const [leading] = rawLines.slice(bodyLines.length + bodyOffset);
|
19 |
|
20 | const succeeds = leading === '';
|
21 | return [
|
22 | negated ? !succeeds : succeeds,
|
23 | message_1.default([
|
24 | 'footer',
|
25 | negated ? 'may not' : 'must',
|
26 | 'have leading blank line',
|
27 | ]),
|
28 | ];
|
29 | };
|
30 | exports.footerLeadingBlank = footerLeadingBlank;
|
31 |
|
\ | No newline at end of file |