subject-exclamation-mark.js 945 B

12345678910111213141516171819202122232425
  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.subjectExclamationMark = void 0;
  7. const message_1 = __importDefault(require("@commitlint/message"));
  8. const subjectExclamationMark = (parsed, when = 'always') => {
  9. const input = parsed.header;
  10. if (!input) {
  11. return [true, ''];
  12. }
  13. const negated = when === 'never';
  14. const hasExclamationMark = /!:/.test(input);
  15. return [
  16. negated ? !hasExclamationMark : hasExclamationMark,
  17. (0, message_1.default)([
  18. 'subject',
  19. negated ? 'must not' : 'must',
  20. 'have an exclamation mark in the subject to identify a breaking change',
  21. ]),
  22. ];
  23. };
  24. exports.subjectExclamationMark = subjectExclamationMark;
  25. //# sourceMappingURL=subject-exclamation-mark.js.map