UNPKG

commitlint-config-ghostwriter

Version:
41 lines (40 loc) 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.run = void 0; const configuration_1 = require("./configuration"); const run = () => { var _a; const config = (0, configuration_1.getConfiguration)(); const hasScopes = Boolean((_a = config.scopes) === null || _a === void 0 ? void 0 : _a.length); const maxLineLength = 120; const supportedCases = [ 'camel-case', 'kebab-case', 'lower-case', 'pascal-case', 'sentence-case', 'snake-case', 'start-case', 'upper-case', ]; return { parserPreset: 'conventional-changelog-ghostwriter', rules: { 'body-leading-blank': [2, 'always'], 'body-max-line-length': [2, 'always', maxLineLength], 'footer-leading-blank': [2, 'always'], 'footer-max-line-length': [2, 'always', maxLineLength], 'header-max-length': [2, 'always', maxLineLength], 'scope-enum': [hasScopes ? 2 : 0, 'always', config.scopes.map(({ type }) => type)], 'scope-case': [0, 'always', supportedCases], 'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']], 'subject-empty': [2, 'never'], 'subject-exclamation-mark': [2, 'never'], 'subject-full-stop': [2, 'never', '.'], 'type-case': [0, 'always', supportedCases], 'type-empty': [2, 'never'], 'type-enum': [2, 'always', config.types.map(({ type }) => type)], }, }; }; exports.run = run;