UNPKG

952 BJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6exports.bodyLeadingBlank = void 0;
7const to_lines_1 = __importDefault(require("@commitlint/to-lines"));
8const message_1 = __importDefault(require("@commitlint/message"));
9const bodyLeadingBlank = (parsed, when) => {
10 // Flunk if no body is found
11 if (!parsed.body) {
12 return [true];
13 }
14 const negated = when === 'never';
15 const [leading] = to_lines_1.default(parsed.raw).slice(1);
16 // Check if the first line of body is empty
17 const succeeds = leading === '';
18 return [
19 negated ? !succeeds : succeeds,
20 message_1.default(['body', negated ? 'may not' : 'must', 'have leading blank line']),
21 ];
22};
23exports.bodyLeadingBlank = bodyLeadingBlank;
24//# sourceMappingURL=body-leading-blank.js.map
\No newline at end of file