body-leading-blank.js 909 B

1234567891011121314151617181920212223
  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.bodyLeadingBlank = void 0;
  7. const to_lines_1 = __importDefault(require("@commitlint/to-lines"));
  8. const message_1 = __importDefault(require("@commitlint/message"));
  9. exports.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. };
  23. //# sourceMappingURL=body-leading-blank.js.map