@html-validate/commitlint-config 4.3.3 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.js CHANGED
@@ -32,6 +32,7 @@ var lib_default = {
32
32
  "body-max-line-length": [RuleConfigSeverity.Error, "always", 100],
33
33
  "footer-leading-blank": [RuleConfigSeverity.Warning, "always"],
34
34
  "footer-max-line-length": [RuleConfigSeverity.Error, "always", 100],
35
+ "header-breaking-change": [RuleConfigSeverity.Error, "never"],
35
36
  "header-max-length": [RuleConfigSeverity.Error, "always", 100],
36
37
  "header-trim": [RuleConfigSeverity.Error, "always"],
37
38
  "subject-case": [
@@ -154,14 +155,90 @@ var lib_default = {
154
155
  }
155
156
  };
156
157
 
158
+ // src/rules/header-backtick-balanced.ts
159
+ var headerBacktickBalanced = (parsed, when = "always") => {
160
+ const header = parsed.header ?? "";
161
+ const count = header.split("`").length - 1;
162
+ const balanced = count % 2 === 0;
163
+ const negated = when === "never";
164
+ return [
165
+ negated ? !balanced : balanced,
166
+ negated ? "header must contain unmatched backticks" : "header must not contain unmatched backticks"
167
+ ];
168
+ };
169
+
170
+ // src/rules/code-spans.ts
171
+ function findCodeSpans(text) {
172
+ const spans = [];
173
+ for (const match of text.matchAll(/`([^`]+)`/g)) {
174
+ const [full, content] = match;
175
+ spans.push({ content, start: match.index, end: match.index + full.length });
176
+ }
177
+ return spans;
178
+ }
179
+
180
+ // src/rules/header-backtick-boundary.ts
181
+ var wordCharacter = /[\p{L}\p{N}_]/u;
182
+ function isWordCharacter(ch) {
183
+ return ch !== void 0 && wordCharacter.test(ch);
184
+ }
185
+ function codePointBefore(text, index) {
186
+ return /.$/su.exec(text.slice(0, index))?.[0];
187
+ }
188
+ function codePointAt(text, index) {
189
+ const codePoint = text.codePointAt(index);
190
+ return codePoint !== void 0 ? String.fromCodePoint(codePoint) : void 0;
191
+ }
192
+ var headerBacktickBoundary = (parsed, when = "always") => {
193
+ const header = parsed.header ?? "";
194
+ const spans = findCodeSpans(header);
195
+ const separated = spans.every(({ start, end }) => {
196
+ const before = codePointBefore(header, start);
197
+ const after = codePointAt(header, end);
198
+ return !isWordCharacter(before) && !isWordCharacter(after);
199
+ });
200
+ const negated = when === "never";
201
+ return [
202
+ negated ? !separated : separated,
203
+ negated ? "code spans in header must not be separated from surrounding words" : "code spans in header must be separated from surrounding words"
204
+ ];
205
+ };
206
+
207
+ // src/rules/header-backtick-trim.ts
208
+ var headerBacktickTrim = (parsed, when = "always") => {
209
+ const header = parsed.header ?? "";
210
+ const spans = findCodeSpans(header);
211
+ const trimmed = spans.every(({ content }) => !/^\s|\s$/.test(content));
212
+ const negated = when === "never";
213
+ return [
214
+ negated ? !trimmed : trimmed,
215
+ negated ? "code spans in header must start or end with whitespace" : "code spans in header must not start or end with whitespace"
216
+ ];
217
+ };
218
+
219
+ // src/rules/index.ts
220
+ var rules = {
221
+ "header-backtick-balanced": headerBacktickBalanced,
222
+ "header-backtick-boundary": headerBacktickBoundary,
223
+ "header-backtick-trim": headerBacktickTrim
224
+ };
225
+
157
226
  // src/config.ts
158
227
  var config = {
159
228
  ...lib_default,
160
229
  parserPreset: fileURLToPath(new URL("parser-preset.js", import.meta.url)),
161
230
  formatter: fileURLToPath(new URL("formatter.js", import.meta.url)),
231
+ plugins: [{ rules }],
162
232
  rules: {
163
233
  ...lib_default.rules,
164
- "header-max-length": [2, "always", 120]
234
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment -- technical debt */
235
+ "header-max-length": [2, "always", 120],
236
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment -- technical debt */
237
+ "header-backtick-balanced": [2, "always"],
238
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment -- technical debt */
239
+ "header-backtick-trim": [2, "always"],
240
+ /* eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment -- technical debt */
241
+ "header-backtick-boundary": [2, "always"]
165
242
  }
166
243
  };
167
244
  if (process.argv[1] === import.meta.filename) {
package/dist/install.js CHANGED
@@ -119,6 +119,11 @@ var require_vendors = __commonJS({
119
119
  ne: "false"
120
120
  }
121
121
  },
122
+ {
123
+ name: "Capawesome Cloud",
124
+ constant: "CAPAWESOME_CLOUD",
125
+ env: "CAPAWESOME_CLOUD"
126
+ },
122
127
  {
123
128
  name: "CircleCI",
124
129
  constant: "CIRCLE",
@@ -301,6 +306,11 @@ var require_vendors = __commonJS({
301
306
  IS_PULL_REQUEST: "true"
302
307
  }
303
308
  },
309
+ {
310
+ name: "RWX",
311
+ constant: "RWX",
312
+ env: "RWX"
313
+ },
304
314
  {
305
315
  name: "Sail CI",
306
316
  constant: "SAIL",
@@ -437,10 +447,10 @@ var require_ci_info = __commonJS({
437
447
  exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
438
448
  (env.BUILD_ID || // Jenkins, Cloudbees
439
449
  env.BUILD_NUMBER || // Jenkins, TeamCity
440
- env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
441
- env.CI_APP_ID || // Appflow
442
- env.CI_BUILD_ID || // Appflow
443
- env.CI_BUILD_NUMBER || // Appflow
450
+ env.CI || // Appveyor, Capawesome Cloud, CircleCI, Cirrus CI, Cloudflare Pages/Workers, CodeShip, dsari, Gitlab CI, RWX, Travis CI
451
+ env.CI_APP_ID || // Appflow, Capawesome Cloud
452
+ env.CI_BUILD_ID || // Appflow, Capawesome Cloud
453
+ env.CI_BUILD_NUMBER || // Appflow, Capawesome Cloud
444
454
  env.CI_NAME || // Codeship and others
445
455
  env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
446
456
  env.RUN_ID || // TaskCluster, dsari
@@ -64,13 +64,20 @@ function url(...parts) {
64
64
  var protectedSegments = [
65
65
  /\[(?:[^[\]]|\[[^[\]]*])*]\((?:[^()\n]|\([^()\n]*\))*\)/,
66
66
  // [text](url)
67
- /\[[^\]]*]\[[^\]]*]/,
67
+ // a text and a label end before the next not nested `[`,
68
+ // so a long run of brackets is not scanned to its end from every one of them
69
+ /\[(?:[^[\]]|\[[^[\]]*])*]\[[^[\]]*]/,
68
70
  // [text][ref]
69
71
  // the lookahead makes the delimiter length atomic, without it a long run
70
- // of backticks makes the regex engine retry every possible delimiter length
71
- /^[ \t]*(?=(?<fence>`{3,}|~{3,}))\k<fence>[\s\S]*?^[ \t]*\k<fence>[ \t]*\r?$/,
72
+ // of backticks makes the regex engine retry every possible delimiter length;
73
+ // as in CommonMark, the info string of backticks has no backticks, and a block
74
+ // without a closing fence lasts to the end, so the next fences don't scan it again
75
+ /^[ \t]*(?=(?<fence>`{3,}|~{3,}))\k<fence>(?:(?<=`)[^`\n]*|(?<=~)[^\n]*)$[\s\S]*?(?:^[ \t]*\k<fence>[ \t]*\r?$|(?![\s\S]))/,
72
76
  // ```code block```
73
- /(?=(?<code>`+))\k<code>[^\n]*?\k<code>/,
77
+ // as in CommonMark, whole runs of backticks of the same length open and close a span;
78
+ // only runs of up to 16 backticks open one, so at most 16 runs without a closing one
79
+ // scan the rest of a line
80
+ /(?<!`)(?=(?<code>`{1,16}(?!`)))\k<code>[^\n]*?(?<!`)\k<code>(?!`)/,
74
81
  // `code span`
75
82
  /https?:\/\/(?:[^\s()]|\([^\s()]*\))+/
76
83
  // https://url
@@ -153,6 +160,13 @@ function reference(reference2) {
153
160
  return strings(reference2.owner && `${reference2.owner}/`, reference2.repository, reference2.issue && `${reference2.prefix || "#"}${reference2.issue}`);
154
161
  }
155
162
 
163
+ // node_modules/@conventional-changelog/template/dist/legacy.js
164
+ function createLegacyWriterGuard(preset) {
165
+ return {
166
+ mainTemplate: `{{[${preset} requires conventional-changelog-writer@9 or newer (conventional-changelog@8 or newer). Your changelog tooling loaded an older writer which cannot render this preset. Update the tooling or use an older major version of the preset.] true}}`
167
+ };
168
+ }
169
+
156
170
  // node_modules/conventional-changelog-conventionalcommits/src/constants.js
157
171
  var BREAKING_HEADER_PATTERN = /^(\w*)(?:\((.*)\))?!: (.*)$/;
158
172
  var DEFAULT_COMMIT_TYPES = Object.freeze([
@@ -451,6 +465,7 @@ function createWriterOpts(config) {
451
465
  const commitGroupOrder = finalConfig.types.map((t) => t.section).filter(Boolean);
452
466
  const formatReferences = createReferencesFormatter(finalConfig);
453
467
  return {
468
+ ...createLegacyWriterGuard("conventional-changelog-conventionalcommits"),
454
469
  template: template.bind(finalConfig),
455
470
  headerPartial: headerPartial.bind(finalConfig),
456
471
  preamblePartial: preamblePartial.bind(finalConfig),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/commitlint-config",
3
- "version": "4.3.3",
3
+ "version": "4.4.0",
4
4
  "description": "Commitlint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "commitlint"