@forsakringskassan/commitlint-config 1.4.1 → 2.0.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/README.md CHANGED
@@ -53,3 +53,19 @@ As a husky hook:
53
53
  ```bash
54
54
  echo 'npm exec commitlint -- --edit "$1"' > .husky/commit-msg
55
55
  ```
56
+
57
+ ### Lint staged
58
+
59
+ This package bundles `lint-staged` and can be used with a preconfigured setup.
60
+ Assuming husky is used add `.husky/pre-commit` with:
61
+
62
+ ```bash
63
+ configfile=$(node -p 'require.resolve("@forsakringskassan/commitlint-config/lint-staged")')
64
+ npm exec lint-staged -- --config "${configfile}" "$@"
65
+ ```
66
+
67
+ If you already have `lint-staged` in your `package.json` you should remove it:
68
+
69
+ ```bash
70
+ npm rm lint-staged
71
+ ```
package/bin/commitlint.js CHANGED
File without changes
package/bin/install.js CHANGED
File without changes
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const binary = fileURLToPath(import.meta.resolve("lint-staged/bin"));
7
+
8
+ spawn("node", [binary, ...process.argv.slice(2)], {
9
+ stdio: "inherit",
10
+ }).on("exit", (code) => {
11
+ process.exit(code);
12
+ });
@@ -98,6 +98,7 @@ var require_re = __commonJS({
98
98
  var re = exports.re = [];
99
99
  var safeRe = exports.safeRe = [];
100
100
  var src = exports.src = [];
101
+ var safeSrc = exports.safeSrc = [];
101
102
  var t = exports.t = {};
102
103
  var R2 = 0;
103
104
  var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
@@ -118,6 +119,7 @@ var require_re = __commonJS({
118
119
  debug(name, index, value2);
119
120
  t[name] = index;
120
121
  src[index] = value2;
122
+ safeSrc[index] = safe;
121
123
  re[index] = new RegExp(value2, isGlobal ? "g" : void 0);
122
124
  safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
123
125
  };
@@ -214,7 +216,7 @@ var require_semver = __commonJS({
214
216
  "node_modules/semver/classes/semver.js"(exports, module) {
215
217
  var debug = require_debug();
216
218
  var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
217
- var { safeRe: re, t } = require_re();
219
+ var { safeRe: re, safeSrc: src, t } = require_re();
218
220
  var parseOptions = require_parse_options();
219
221
  var { compareIdentifiers } = require_identifiers();
220
222
  var SemVer = class _SemVer {
@@ -354,6 +356,18 @@ var require_semver = __commonJS({
354
356
  // preminor will bump the version up to the next minor release, and immediately
355
357
  // down to pre-release. premajor and prepatch work the same way.
356
358
  inc(release, identifier, identifierBase) {
359
+ if (release.startsWith("pre")) {
360
+ if (!identifier && identifierBase === false) {
361
+ throw new Error("invalid increment argument: identifier is empty");
362
+ }
363
+ if (identifier) {
364
+ const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
365
+ const match2 = `-${identifier}`.match(r);
366
+ if (!match2 || match2[1] !== identifier) {
367
+ throw new Error(`invalid identifier: ${identifier}`);
368
+ }
369
+ }
370
+ }
357
371
  switch (release) {
358
372
  case "premajor":
359
373
  this.prerelease.length = 0;
@@ -381,6 +395,12 @@ var require_semver = __commonJS({
381
395
  }
382
396
  this.inc("pre", identifier, identifierBase);
383
397
  break;
398
+ case "release":
399
+ if (this.prerelease.length === 0) {
400
+ throw new Error(`version ${this.raw} is not a prerelease`);
401
+ }
402
+ this.prerelease.length = 0;
403
+ break;
384
404
  case "major":
385
405
  if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
386
406
  this.major++;
@@ -406,9 +426,6 @@ var require_semver = __commonJS({
406
426
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
407
427
  case "pre": {
408
428
  const base = Number(identifierBase) ? 1 : 0;
409
- if (!identifier && identifierBase === false) {
410
- throw new Error("invalid increment argument: identifier is empty");
411
- }
412
429
  if (this.prerelease.length === 0) {
413
430
  this.prerelease = [base];
414
431
  } else {
@@ -543,13 +560,12 @@ var require_diff = __commonJS({
543
560
  if (!lowVersion.patch && !lowVersion.minor) {
544
561
  return "major";
545
562
  }
546
- if (highVersion.patch) {
563
+ if (lowVersion.compareMain(highVersion) === 0) {
564
+ if (lowVersion.minor && !lowVersion.patch) {
565
+ return "minor";
566
+ }
547
567
  return "patch";
548
568
  }
549
- if (highVersion.minor) {
550
- return "minor";
551
- }
552
- return "major";
553
569
  }
554
570
  const prefix2 = highHasPre ? "pre" : "";
555
571
  if (v1.major !== v2.major) {
@@ -238195,7 +238211,7 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
238195
238211
  return cp;
238196
238212
  }
238197
238213
  setStrict(strict) {
238198
- this.state.strict = strict, strict && (this.state.strictErrors.forEach(([toParseError, at2]) => this.raise(toParseError, at2)), this.state.strictErrors.clear());
238214
+ this.state.strict = strict, strict && (this.state.strictErrors.forEach(([toParseError, at]) => this.raise(toParseError, at)), this.state.strictErrors.clear());
238199
238215
  }
238200
238216
  curContext() {
238201
238217
  return this.state.context[this.state.context.length - 1];
@@ -238553,9 +238569,9 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
238553
238569
  const opening = this.input[this.state.pos], { str, firstInvalidLoc, pos, curLine, lineStart } = readStringContents("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
238554
238570
  this.state.pos = pos + 1, this.state.lineStart = lineStart, this.state.curLine = curLine, firstInvalidLoc && (this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos))), 96 === this.input.codePointAt(pos) ? this.finishToken(24, firstInvalidLoc ? null : opening + str + "`") : (this.state.pos++, this.finishToken(25, firstInvalidLoc ? null : opening + str + "${"));
238555
238571
  }
238556
- recordStrictModeErrors(toParseError, at2) {
238557
- const index = at2.index;
238558
- this.state.strict && !this.state.strictErrors.has(index) ? this.raise(toParseError, at2) : this.state.strictErrors.set(index, [toParseError, at2]);
238572
+ recordStrictModeErrors(toParseError, at) {
238573
+ const index = at.index;
238574
+ this.state.strict && !this.state.strictErrors.has(index) ? this.raise(toParseError, at) : this.state.strictErrors.set(index, [toParseError, at]);
238559
238575
  }
238560
238576
  readWord1(firstCode) {
238561
238577
  this.state.containsEsc = false;
@@ -238590,19 +238606,19 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
238590
238606
  const { type } = this.state;
238591
238607
  tokenIsKeyword(type) && this.state.containsEsc && this.raise(Errors.InvalidEscapedReservedWord, this.state.startLoc, { reservedWord: tokenLabelName(type) });
238592
238608
  }
238593
- raise(toParseError, at2, details = {}) {
238594
- const error = toParseError(at2 instanceof Position ? at2 : at2.loc.start, details);
238609
+ raise(toParseError, at, details = {}) {
238610
+ const error = toParseError(at instanceof Position ? at : at.loc.start, details);
238595
238611
  if (!this.options.errorRecovery) throw error;
238596
238612
  return this.isLookahead || this.state.errors.push(error), error;
238597
238613
  }
238598
- raiseOverwrite(toParseError, at2, details = {}) {
238599
- const loc = at2 instanceof Position ? at2 : at2.loc.start, pos = loc.index, errors = this.state.errors;
238614
+ raiseOverwrite(toParseError, at, details = {}) {
238615
+ const loc = at instanceof Position ? at : at.loc.start, pos = loc.index, errors = this.state.errors;
238600
238616
  for (let i = errors.length - 1; i >= 0; i--) {
238601
238617
  const error = errors[i];
238602
238618
  if (error.loc.index === pos) return errors[i] = toParseError(loc, details);
238603
238619
  if (error.loc.index < pos) break;
238604
238620
  }
238605
- return this.raise(toParseError, at2, details);
238621
+ return this.raise(toParseError, at, details);
238606
238622
  }
238607
238623
  updateContext(prevType) {
238608
238624
  }
@@ -238673,9 +238689,9 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
238673
238689
  constructor(type) {
238674
238690
  super(type), this.declarationErrors = /* @__PURE__ */ new Map();
238675
238691
  }
238676
- recordDeclarationError(ParsingErrorClass, at2) {
238677
- const index = at2.index;
238678
- this.declarationErrors.set(index, [ParsingErrorClass, at2]);
238692
+ recordDeclarationError(ParsingErrorClass, at) {
238693
+ const index = at.index;
238694
+ this.declarationErrors.set(index, [ParsingErrorClass, at]);
238679
238695
  }
238680
238696
  clearDeclarationError(index) {
238681
238697
  this.declarationErrors.delete(index);
@@ -238711,10 +238727,10 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
238711
238727
  scope.recordDeclarationError(error, origin);
238712
238728
  }
238713
238729
  }
238714
- recordAsyncArrowParametersError(at2) {
238730
+ recordAsyncArrowParametersError(at) {
238715
238731
  const { stack } = this;
238716
238732
  let i = stack.length - 1, scope = stack[i];
238717
- for (; scope.canBeArrowParameterDeclaration(); ) 2 === scope.type && scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at2), scope = stack[--i];
238733
+ for (; scope.canBeArrowParameterDeclaration(); ) 2 === scope.type && scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at), scope = stack[--i];
238718
238734
  }
238719
238735
  validateAsPattern() {
238720
238736
  const { stack } = this, currentScope = stack[stack.length - 1];
@@ -239203,8 +239219,8 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
239203
239219
  if (Array.isArray(val)) for (const child of val) child && this.checkLVal(child, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
239204
239220
  else val && this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression);
239205
239221
  }
239206
- checkIdentifier(at2, bindingType, strictModeChanged = false) {
239207
- this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at2.name, this.inModule) : isStrictBindOnlyReservedWord(at2.name)) && (64 === bindingType ? this.raise(Errors.StrictEvalArguments, at2, { referenceName: at2.name }) : this.raise(Errors.StrictEvalArgumentsBinding, at2, { bindingName: at2.name })), 8192 & bindingType && "let" === at2.name && this.raise(Errors.LetInLexicalBinding, at2), 64 & bindingType || this.declareNameFromIdentifier(at2, bindingType);
239222
+ checkIdentifier(at, bindingType, strictModeChanged = false) {
239223
+ this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name)) && (64 === bindingType ? this.raise(Errors.StrictEvalArguments, at, { referenceName: at.name }) : this.raise(Errors.StrictEvalArgumentsBinding, at, { bindingName: at.name })), 8192 & bindingType && "let" === at.name && this.raise(Errors.LetInLexicalBinding, at), 64 & bindingType || this.declareNameFromIdentifier(at, bindingType);
239208
239224
  }
239209
239225
  declareNameFromIdentifier(identifier, binding) {
239210
239226
  this.scope.declareName(identifier.name, binding, identifier.loc.start);
@@ -242929,7 +242945,7 @@ See https://babeljs.io/docs/configuration#print-effective-configs for more info.
242929
242945
  }
242930
242946
  parseProgram(program, end = 140, sourceType = this.options.sourceType) {
242931
242947
  if (program.sourceType = sourceType, program.interpreter = this.parseInterpreterDirective(), this.parseBlockBody(program, true, true, end), this.inModule) {
242932
- if (!this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) for (const [localName, at2] of Array.from(this.scope.undefinedExports)) this.raise(Errors.ModuleExportUndefined, at2, { localName });
242948
+ if (!this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) for (const [localName, at] of Array.from(this.scope.undefinedExports)) this.raise(Errors.ModuleExportUndefined, at, { localName });
242933
242949
  this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
242934
242950
  }
242935
242951
  let finishedProgram;
@@ -256355,13 +256371,13 @@ var require_git_raw_commits = __commonJS({
256355
256371
  });
256356
256372
 
256357
256373
  // node_modules/@commitlint/cli/lib/cli.js
256358
- import { createRequire as createRequire4 } from "module";
256359
- import path13 from "path";
256360
- import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL4 } from "url";
256361
- import util2 from "util";
256374
+ import { createRequire as createRequire4 } from "node:module";
256375
+ import path13 from "node:path";
256376
+ import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL4 } from "node:url";
256377
+ import util2 from "node:util";
256362
256378
 
256363
256379
  // node_modules/@commitlint/lint/lib/lint.js
256364
- import util from "util";
256380
+ import util from "node:util";
256365
256381
 
256366
256382
  // node_modules/@commitlint/is-ignored/lib/defaults.js
256367
256383
  var import_semver = __toESM(require_semver2(), 1);
@@ -256387,35 +256403,18 @@ var wildcards = [
256387
256403
  test(/^Auto-merged (.*?) into (.*)/)
256388
256404
  ];
256389
256405
 
256390
- // node_modules/@commitlint/is-ignored/lib/validate-ignore-func.js
256391
- function validateIgnoreFunction(fn) {
256392
- const fnString = fn.toString();
256393
- const dangerousPattern = /(?:process|require|import|eval|fetch|XMLHttpRequest|fs|child_process)(?:\s*\.|\s*\()|(?:exec|execFile|spawn)\s*\(/;
256394
- if (dangerousPattern.test(fnString)) {
256395
- const match2 = fnString.match(dangerousPattern);
256396
- throw new Error(`Ignore function contains forbidden pattern: ${match2?.[0].trim()}`);
256397
- }
256398
- }
256399
-
256400
256406
  // node_modules/@commitlint/is-ignored/lib/is-ignored.js
256401
256407
  function isIgnored(commit = "", opts = {}) {
256402
256408
  const ignores = typeof opts.ignores === "undefined" ? [] : opts.ignores;
256403
256409
  if (!Array.isArray(ignores)) {
256404
256410
  throw new Error(`ignores must be of type array, received ${ignores} of type ${typeof ignores}`);
256405
256411
  }
256406
- ignores.forEach(validateIgnoreFunction);
256407
256412
  const invalids = ignores.filter((c) => typeof c !== "function");
256408
256413
  if (invalids.length > 0) {
256409
256414
  throw new Error(`ignores must be array of type function, received items of type: ${invalids.map((i) => typeof i).join(", ")}`);
256410
256415
  }
256411
256416
  const base = opts.defaults === false ? [] : wildcards;
256412
- return [...base, ...ignores].some((w) => {
256413
- const result = w(commit);
256414
- if (typeof result !== "boolean") {
256415
- throw new Error(`Ignore function must return a boolean, received ${typeof result}`);
256416
- }
256417
- return result;
256418
- });
256417
+ return [...base, ...ignores].some((w) => w(commit));
256419
256418
  }
256420
256419
 
256421
256420
  // node_modules/@commitlint/parse/lib/index.js
@@ -256738,24 +256737,17 @@ var headerMinLength = (parsed, _when = void 0, value2 = 0) => {
256738
256737
  // node_modules/@commitlint/rules/lib/header-trim.js
256739
256738
  var headerTrim = (parsed) => {
256740
256739
  const { header } = parsed;
256741
- if (!header) {
256740
+ if (!header)
256742
256741
  return [true];
256743
- }
256744
- const startsWithWhiteSpace = header !== header.trimStart();
256745
- const endsWithWhiteSpace = header !== header.trimEnd();
256746
- switch (true) {
256747
- case (startsWithWhiteSpace && endsWithWhiteSpace):
256748
- return [
256749
- false,
256750
- message(["header", "must not be surrounded by whitespace"])
256751
- ];
256752
- case startsWithWhiteSpace:
256753
- return [false, message(["header", "must not start with whitespace"])];
256754
- case endsWithWhiteSpace:
256755
- return [false, message(["header", "must not end with whitespace"])];
256756
- default:
256757
- return [true];
256758
- }
256742
+ const startsWithWhiteSpace = header.length > header.trimStart().length;
256743
+ const endsWithWhiteSpace = header.length > header.trimEnd().length;
256744
+ if (startsWithWhiteSpace && endsWithWhiteSpace)
256745
+ return [false, message(["header", "must not be surrounded by whitespace"])];
256746
+ if (startsWithWhiteSpace)
256747
+ return [false, message(["header", "must not start with whitespace"])];
256748
+ if (endsWithWhiteSpace)
256749
+ return [false, message(["header", "must not end with whitespace"])];
256750
+ return [true];
256759
256751
  };
256760
256752
 
256761
256753
  // node_modules/@commitlint/rules/lib/references-empty.js
@@ -256968,7 +256960,7 @@ var subjectExclamationMark = (parsed, when = "always") => {
256968
256960
  };
256969
256961
 
256970
256962
  // node_modules/@commitlint/rules/lib/trailer-exists.js
256971
- import { spawnSync } from "child_process";
256963
+ import { spawnSync } from "node:child_process";
256972
256964
  var trailerExists = (parsed, when = "always", value2 = "") => {
256973
256965
  const trailers = spawnSync("git", ["interpret-trailers", "--parse"], {
256974
256966
  input: parsed.raw || ""
@@ -257225,11 +257217,11 @@ async function lint(message2, rawRulesConfig, rawOpts) {
257225
257217
  }
257226
257218
 
257227
257219
  // node_modules/@commitlint/load/lib/load.js
257228
- import path8 from "path";
257220
+ import path8 from "node:path";
257229
257221
 
257230
257222
  // node_modules/@commitlint/config-validator/lib/validate.js
257231
257223
  var import_ajv = __toESM(require_ajv(), 1);
257232
- import { createRequire } from "module";
257224
+ import { createRequire } from "node:module";
257233
257225
 
257234
257226
  // node_modules/@commitlint/config-validator/lib/formatErrors.js
257235
257227
  function formatErrors(errors) {
@@ -257306,9 +257298,9 @@ function executable(config) {
257306
257298
  }
257307
257299
 
257308
257300
  // node_modules/@commitlint/resolve-extends/lib/index.js
257309
- import fs3 from "fs";
257310
- import path4 from "path";
257311
- import { pathToFileURL as pathToFileURL2, fileURLToPath as fileURLToPath5 } from "url";
257301
+ import fs3 from "node:fs";
257302
+ import path4 from "node:path";
257303
+ import { pathToFileURL as pathToFileURL2, fileURLToPath as fileURLToPath5 } from "node:url";
257312
257304
 
257313
257305
  // node_modules/global-directory/index.js
257314
257306
  var import_ini = __toESM(require_ini(), 1);
@@ -258790,8 +258782,8 @@ var import_lodash9 = __toESM(require_lodash9(), 1);
258790
258782
 
258791
258783
  // node_modules/@commitlint/load/lib/utils/load-config.js
258792
258784
  var import_cosmiconfig = __toESM(require_dist2(), 1);
258793
- import { existsSync, readFileSync } from "fs";
258794
- import path5 from "path";
258785
+ import { existsSync, readFileSync } from "node:fs";
258786
+ import path5 from "node:path";
258795
258787
 
258796
258788
  // node_modules/jiti/lib/jiti.mjs
258797
258789
  var import_jiti = __toESM(require_jiti(), 1);
@@ -258956,9 +258948,9 @@ async function loadParserOpts(pendingParser) {
258956
258948
  }
258957
258949
 
258958
258950
  // node_modules/@commitlint/load/lib/utils/load-plugin.js
258959
- import { createRequire as createRequire3 } from "module";
258960
- import path7 from "path";
258961
- import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "url";
258951
+ import { createRequire as createRequire3 } from "node:module";
258952
+ import path7 from "node:path";
258953
+ import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL3 } from "node:url";
258962
258954
 
258963
258955
  // node_modules/@commitlint/load/node_modules/chalk/source/vendor/ansi-styles/index.js
258964
258956
  var ANSI_BACKGROUND_OFFSET = 10;
@@ -259450,7 +259442,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
259450
259442
  var source_default = chalk;
259451
259443
 
259452
259444
  // node_modules/@commitlint/load/lib/utils/plugin-naming.js
259453
- import path6 from "path";
259445
+ import path6 from "node:path";
259454
259446
  var prefix = "commitlint-plugin";
259455
259447
  function convertPathToPosix(filepath) {
259456
259448
  const normalizedFilepath = path6.normalize(filepath);
@@ -259648,7 +259640,7 @@ async function getHistoryCommits(options, opts = {}) {
259648
259640
  }
259649
259641
 
259650
259642
  // node_modules/@commitlint/top-level/lib/index.js
259651
- import path11 from "path";
259643
+ import path11 from "node:path";
259652
259644
 
259653
259645
  // node_modules/@commitlint/top-level/node_modules/find-up/index.js
259654
259646
  import path10 from "node:path";
@@ -259715,6 +259707,11 @@ var Queue = class {
259715
259707
  current = current.next;
259716
259708
  }
259717
259709
  }
259710
+ *drain() {
259711
+ while (this.#head) {
259712
+ yield this.dequeue();
259713
+ }
259714
+ }
259718
259715
  };
259719
259716
 
259720
259717
  // node_modules/@commitlint/top-level/node_modules/p-limit/index.js
@@ -259897,7 +259894,7 @@ async function searchDotGit(cwd) {
259897
259894
  import fs6 from "fs/promises";
259898
259895
 
259899
259896
  // node_modules/@commitlint/read/lib/get-edit-file-path.js
259900
- import path12 from "path";
259897
+ import path12 from "node:path";
259901
259898
  import fs5 from "fs/promises";
259902
259899
  async function getEditFilePath(top2, edit) {
259903
259900
  if (typeof edit === "string") {
@@ -260012,7 +260009,7 @@ var X = l((ke, B) => {
260012
260009
  return t.isFile() && Kt(t, e);
260013
260010
  }
260014
260011
  function Kt(t, e) {
260015
- var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), u = parseInt("100", 8), c = parseInt("010", 8), a = parseInt("001", 8), f = u | c, p = n & a || n & c && s === i || n & u && r === o || n & f && o === 0;
260012
+ var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), a = parseInt("100", 8), c = parseInt("010", 8), u = parseInt("001", 8), f = a | c, p = n & u || n & c && s === i || n & a && r === o || n & f && o === 0;
260016
260013
  return p;
260017
260014
  }
260018
260015
  });
@@ -260062,30 +260059,30 @@ var et = l((Re, tt) => {
260062
260059
  };
260063
260060
  }, Z = (t, e, n) => {
260064
260061
  typeof e == "function" && (n = e, e = {}), e || (e = {});
260065
- let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], u = (a) => new Promise((f, p) => {
260066
- if (a === r.length)
260062
+ let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], a = (u) => new Promise((f, p) => {
260063
+ if (u === r.length)
260067
260064
  return e.all && i.length ? f(i) : p(J(t));
260068
- let d = r[a], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m;
260069
- f(c(b, a, 0));
260070
- }), c = (a, f, p) => new Promise((d, w) => {
260065
+ let d = r[u], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m;
260066
+ f(c(b, u, 0));
260067
+ }), c = (u, f, p) => new Promise((d, w) => {
260071
260068
  if (p === s.length)
260072
- return d(u(f + 1));
260069
+ return d(a(f + 1));
260073
260070
  let m = s[p];
260074
- V(a + m, { pathExt: o }, (b, Ot) => {
260071
+ V(u + m, { pathExt: o }, (b, Ot) => {
260075
260072
  if (!b && Ot)
260076
260073
  if (e.all)
260077
- i.push(a + m);
260074
+ i.push(u + m);
260078
260075
  else
260079
- return d(a + m);
260080
- return d(c(a, f, p + 1));
260076
+ return d(u + m);
260077
+ return d(c(u, f, p + 1));
260081
260078
  });
260082
260079
  });
260083
- return n ? u(0).then((a) => n(null, a), n) : u(0);
260080
+ return n ? a(0).then((u) => n(null, u), n) : a(0);
260084
260081
  }, Xt = (t, e) => {
260085
260082
  e = e || {};
260086
260083
  let { pathEnv: n, pathExt: r, pathExtExe: s } = Q(t, e), o = [];
260087
260084
  for (let i = 0; i < n.length; i++) {
260088
- let u = n[i], c = /^".*"$/.test(u) ? u.slice(1, -1) : u, a = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + a : a;
260085
+ let a = n[i], c = /^".*"$/.test(a) ? a.slice(1, -1) : a, u = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + u : u;
260089
260086
  for (let p = 0; p < r.length; p++) {
260090
260087
  let d = f + r[p];
260091
260088
  try {
@@ -260143,21 +260140,21 @@ var ct = l((Ne, it) => {
260143
260140
  }
260144
260141
  it.exports = Yt;
260145
260142
  });
260146
- var at = l((qe, C) => {
260143
+ var ut = l((qe, P) => {
260147
260144
  "use strict";
260148
- var P = /([()\][%!^"`<>&|;, *?])/g;
260145
+ var C = /([()\][%!^"`<>&|;, *?])/g;
260149
260146
  function Vt(t) {
260150
- return t = t.replace(P, "^$1"), t;
260147
+ return t = t.replace(C, "^$1"), t;
260151
260148
  }
260152
260149
  function Jt(t, e) {
260153
- return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(P, "^$1"), e && (t = t.replace(P, "^$1")), t;
260150
+ return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
260154
260151
  }
260155
- C.exports.command = Vt;
260156
- C.exports.argument = Jt;
260152
+ P.exports.command = Vt;
260153
+ P.exports.argument = Jt;
260157
260154
  });
260158
- var lt = l((Ie, ut) => {
260155
+ var lt = l((Ie, at) => {
260159
260156
  "use strict";
260160
- ut.exports = /^#!(.*)/;
260157
+ at.exports = /^#!(.*)/;
260161
260158
  });
260162
260159
  var dt = l((Le, pt) => {
260163
260160
  "use strict";
@@ -260185,7 +260182,7 @@ var ht = l((je, ft) => {
260185
260182
  });
260186
260183
  var wt = l((Fe, Et) => {
260187
260184
  "use strict";
260188
- var ee = h("path"), mt = ct(), gt = at(), ne = ht(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
260185
+ var ee = h("path"), mt = ct(), gt = ut(), ne = ht(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
260189
260186
  function ie(t) {
260190
260187
  t.file = mt(t);
260191
260188
  let e = t.file && ne(t.file);
@@ -260203,7 +260200,7 @@ var wt = l((Fe, Et) => {
260203
260200
  }
260204
260201
  return t;
260205
260202
  }
260206
- function ae(t, e, n) {
260203
+ function ue(t, e, n) {
260207
260204
  e && !Array.isArray(e) && (n = e, e = null), e = e ? e.slice(0) : [], n = Object.assign({}, n);
260208
260205
  let r = {
260209
260206
  command: t,
@@ -260217,7 +260214,7 @@ var wt = l((Fe, Et) => {
260217
260214
  };
260218
260215
  return n.shell ? r : ce(r);
260219
260216
  }
260220
- Et.exports = ae;
260217
+ Et.exports = ue;
260221
260218
  });
260222
260219
  var bt = l((ze, vt) => {
260223
260220
  "use strict";
@@ -260231,7 +260228,7 @@ var bt = l((ze, vt) => {
260231
260228
  spawnargs: t.args
260232
260229
  });
260233
260230
  }
260234
- function ue(t, e) {
260231
+ function ae(t, e) {
260235
260232
  if (!S)
260236
260233
  return;
260237
260234
  let n = t.emit;
@@ -260251,13 +260248,13 @@ var bt = l((ze, vt) => {
260251
260248
  return S && t === 1 && !e.file ? k(e.original, "spawnSync") : null;
260252
260249
  }
260253
260250
  vt.exports = {
260254
- hookChildProcess: ue,
260251
+ hookChildProcess: ae,
260255
260252
  verifyENOENT: xt,
260256
260253
  verifyENOENTSync: le,
260257
260254
  notFoundError: k
260258
260255
  };
260259
260256
  });
260260
- var Pt = l((He, E) => {
260257
+ var Ct = l((He, E) => {
260261
260258
  "use strict";
260262
260259
  var yt = h("child_process"), T = wt(), A = bt();
260263
260260
  function _t(t, e, n) {
@@ -260307,7 +260304,7 @@ var L = (t) => {
260307
260304
  s.pipe(n, { end: false }), s.on("end", r);
260308
260305
  return n;
260309
260306
  };
260310
- var Ct = Nt(Pt(), 1);
260307
+ var Pt = Nt(Ct(), 1);
260311
260308
  var x = class extends Error {
260312
260309
  result;
260313
260310
  output;
@@ -260409,17 +260406,18 @@ var R = class {
260409
260406
  if (!e)
260410
260407
  throw new Error("No process was started");
260411
260408
  let n = "", r = "";
260412
- if (this._streamErr)
260413
- for await (let o of this._streamErr)
260414
- n += o.toString();
260415
260409
  if (this._streamOut)
260416
260410
  for await (let o of this._streamOut)
260417
260411
  r += o.toString();
260412
+ if (this._streamErr)
260413
+ for await (let o of this._streamErr)
260414
+ n += o.toString();
260418
260415
  if (await this._processClosed, this._options?.stdin && await this._options.stdin, e.removeAllListeners(), this._thrownError)
260419
260416
  throw this._thrownError;
260420
260417
  let s = {
260421
260418
  stderr: n,
260422
- stdout: r
260419
+ stdout: r,
260420
+ exitCode: this.exitCode
260423
260421
  };
260424
260422
  if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
260425
260423
  throw new x(this, s);
@@ -260436,14 +260434,14 @@ var R = class {
260436
260434
  ...n.nodeOptions
260437
260435
  }, s = [];
260438
260436
  this._resetState(), n.timeout !== void 0 && s.push(AbortSignal.timeout(n.timeout)), n.signal !== void 0 && s.push(n.signal), n.persist === true && (r.detached = true), s.length > 0 && (r.signal = xe(s)), r.env = I(e, r.env);
260439
- let { command: o, args: i } = we(this._command, this._args), u = (0, Ct._parse)(o, i, r), c = de(
260440
- u.command,
260441
- u.args,
260442
- u.options
260437
+ let { command: o, args: i } = we(this._command, this._args), a = (0, Pt._parse)(o, i, r), c = de(
260438
+ a.command,
260439
+ a.args,
260440
+ a.options
260443
260441
  );
260444
260442
  if (c.stderr && (this._streamErr = c.stderr), c.stdout && (this._streamOut = c.stdout), this._process = c, c.once("error", this._onError), c.once("close", this._onClose), n.stdin !== void 0 && c.stdin && n.stdin.process) {
260445
- let { stdout: a } = n.stdin.process;
260446
- a && a.pipe(c.stdin);
260443
+ let { stdout: u } = n.stdin.process;
260444
+ u && u.pipe(c.stdin);
260447
260445
  }
260448
260446
  }
260449
260447
  _resetState() {
@@ -265711,8 +265709,6 @@ typescript/lib/typescript.js:
265711
265709
  ***************************************************************************** *)
265712
265710
 
265713
265711
  cosmiconfig/dist/loaders.js:
265714
- (* istanbul ignore next -- @preserve *)
265715
-
265716
265712
  cosmiconfig/dist/util.js:
265717
265713
  (* istanbul ignore next -- @preserve *)
265718
265714
 
@@ -265721,32 +265717,12 @@ cosmiconfig/dist/ExplorerBase.js:
265721
265717
  (* istanbul ignore next -- @preserve *)
265722
265718
 
265723
265719
  cosmiconfig/dist/Explorer.js:
265724
- (* istanbul ignore if -- @preserve *)
265725
-
265726
265720
  cosmiconfig/dist/ExplorerSync.js:
265727
265721
  (* istanbul ignore if -- @preserve *)
265728
265722
 
265729
265723
  yargs-parser/build/lib/string-utils.js:
265730
- (**
265731
- * @license
265732
- * Copyright (c) 2016, Contributors
265733
- * SPDX-License-Identifier: ISC
265734
- *)
265735
-
265736
265724
  yargs-parser/build/lib/tokenize-arg-string.js:
265737
- (**
265738
- * @license
265739
- * Copyright (c) 2016, Contributors
265740
- * SPDX-License-Identifier: ISC
265741
- *)
265742
-
265743
265725
  yargs-parser/build/lib/yargs-parser-types.js:
265744
- (**
265745
- * @license
265746
- * Copyright (c) 2016, Contributors
265747
- * SPDX-License-Identifier: ISC
265748
- *)
265749
-
265750
265726
  yargs-parser/build/lib/yargs-parser.js:
265751
265727
  (**
265752
265728
  * @license
package/dist/format.js CHANGED
@@ -267,10 +267,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
267
267
  return 1;
268
268
  }
269
269
  if ("CI" in env) {
270
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
270
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
271
271
  return 3;
272
272
  }
273
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
273
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
274
274
  return 1;
275
275
  }
276
276
  return min;
package/lint-staged.js ADDED
@@ -0,0 +1,17 @@
1
+ const eslint = ["js", "cjs", "mjs", "cts", "mts", "vue", "ts"];
2
+ const eslintPatterns = eslint.map((it) => `*.${it}`);
3
+ const eslintGlob = `(${eslintPatterns.join("|")})`;
4
+
5
+ /**
6
+ * @type {import('lint-staged').Configuration}
7
+ */
8
+ const config = {
9
+ [eslintGlob]: ["prettier --write", "eslint --fix"],
10
+ [`!${eslintGlob}`]: ["prettier --ignore-unknown --write"],
11
+ };
12
+
13
+ if (process.argv[1] === import.meta.filename) {
14
+ console.log(config);
15
+ }
16
+
17
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/commitlint-config",
3
- "version": "1.4.1",
3
+ "version": "2.0.0",
4
4
  "description": "FK commitlint shareable config",
5
5
  "keywords": [
6
6
  "commitlint"
@@ -17,17 +17,20 @@
17
17
  "exports": {
18
18
  ".": "./dist/config/default.js",
19
19
  "./default": "./dist/config/default.js",
20
- "./no-jira": "./dist/config/no-jira.js"
20
+ "./no-jira": "./dist/config/no-jira.js",
21
+ "./lint-staged": "./lint-staged.js"
21
22
  },
22
23
  "main": "dist/config/default.js",
23
24
  "bin": {
24
25
  "commitlint": "bin/commitlint.js",
25
- "commitlint-config": "bin/install.js"
26
+ "commitlint-config": "bin/install.js",
27
+ "lint-staged": "bin/lint-staged.js"
26
28
  },
27
29
  "files": [
28
30
  "bin",
29
31
  "dist",
30
- "gitmessage"
32
+ "gitmessage",
33
+ "lint-staged.js"
31
34
  ],
32
35
  "scripts": {
33
36
  "prebuild": "rimraf dist",
@@ -53,6 +56,6 @@
53
56
  "ts-node": "^10"
54
57
  },
55
58
  "engines": {
56
- "node": ">= 18"
59
+ "node": ">= 20.18"
57
60
  }
58
61
  }