@commitlint/ensure 21.2.3 → 21.3.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/lib/case.d.ts.map +1 -1
- package/lib/case.js +2 -1
- package/lib/case.js.map +1 -1
- package/lib/max-line-length.d.ts.map +1 -1
- package/lib/max-line-length.js +8 -4
- package/lib/max-line-length.js.map +1 -1
- package/package.json +3 -3
package/lib/case.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../src/case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;eAIzC,UAAU;AAEzB,iBAAS,UAAU,CAAC,GAAG,GAAE,MAAW,EAAE,MAAM,GAAE,cAA4B,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"case.d.ts","sourceRoot":"","sources":["../src/case.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;eAIzC,UAAU;AAEzB,iBAAS,UAAU,CAAC,GAAG,GAAE,MAAW,EAAE,MAAM,GAAE,cAA4B,GAAG,OAAO,CAenF"}
|
package/lib/case.js
CHANGED
|
@@ -3,8 +3,9 @@ export default ensureCase;
|
|
|
3
3
|
function ensureCase(raw = "", target = "lowercase") {
|
|
4
4
|
// We delete any content together with quotes because he can contains proper names (example `refactor: `Eslint` configuration`).
|
|
5
5
|
// We need trim string because content with quotes can be at the beginning or end of a line
|
|
6
|
+
// An apostrophe inside a word (`don't`, `it's`) does not open or close a quote.
|
|
6
7
|
const input = String(raw)
|
|
7
|
-
.replace(/`.*?`|".*?"|'.*?'/
|
|
8
|
+
.replace(/`.*?`|".*?"|(?<![\p{L}\p{M}\p{N}])'.*?'(?![\p{L}\p{M}\p{N}])/gu, "")
|
|
8
9
|
.trim();
|
|
9
10
|
const transformed = toCase(input, target);
|
|
10
11
|
if (transformed === "" || transformed.match(/^\d/)) {
|
package/lib/case.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"case.js","sourceRoot":"","sources":["../src/case.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,eAAe,UAAU,CAAC;AAE1B,SAAS,UAAU,CAAC,GAAG,GAAW,EAAE,EAAE,MAAM,GAAmB,WAAW;IACzE,gIAAgI;IAChI,2FAA2F;IAC3F,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;SACvB,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"case.js","sourceRoot":"","sources":["../src/case.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,eAAe,UAAU,CAAC;AAE1B,SAAS,UAAU,CAAC,GAAG,GAAW,EAAE,EAAE,MAAM,GAAmB,WAAW;IACzE,gIAAgI;IAChI,2FAA2F;IAC3F,gFAAgF;IAChF,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC;SACvB,OAAO,CAAC,gEAAgE,EAAE,EAAE,CAAC;SAC7E,IAAI,EAAE,CAAC;IAET,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAE1C,IAAI,WAAW,KAAK,EAAE,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,WAAW,KAAK,KAAK,CAAC;AAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-line-length.d.ts","sourceRoot":"","sources":["../src/max-line-length.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"max-line-length.d.ts","sourceRoot":"","sources":["../src/max-line-length.ts"],"names":[],"mappings":";0BAUgB,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO"}
|
package/lib/max-line-length.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import ensure from "./max-length.js";
|
|
2
|
-
// Allow an exception for long lines which contain URLs
|
|
2
|
+
// Allow an exception for long lines which contain URLs or trailer lines with
|
|
3
|
+
// email addresses (such as Co-authored-by or Signed-off-by).
|
|
3
4
|
//
|
|
4
|
-
//
|
|
5
|
-
// have to worry about all the many edge cases of valid URLs.
|
|
5
|
+
// These regexes are intentionally simple, in order to avoid costly regexps
|
|
6
|
+
// which have to worry about all the many edge cases of valid URLs and emails.
|
|
6
7
|
const URL_REGEX = /\bhttps?:\/\/\S+/;
|
|
8
|
+
const TRAILER_EMAIL_REGEX = /^[\w-]+:\s.*<[^<>\s@]+@[^<>\s@]+>\s*$/;
|
|
7
9
|
export default (value, max) => typeof value === "string" &&
|
|
8
|
-
value
|
|
10
|
+
value
|
|
11
|
+
.split(/\r?\n/)
|
|
12
|
+
.every((line) => ensure(line, max) || URL_REGEX.test(line) || TRAILER_EMAIL_REGEX.test(line));
|
|
9
13
|
//# sourceMappingURL=max-line-length.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-line-length.js","sourceRoot":"","sources":["../src/max-line-length.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,
|
|
1
|
+
{"version":3,"file":"max-line-length.js","sourceRoot":"","sources":["../src/max-line-length.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,6EAA6E;AAC7E,6DAA6D;AAC7D,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,MAAM,SAAS,GAAG,kBAAkB,CAAC;AACrC,MAAM,mBAAmB,GAAG,uCAAuC,CAAC;AAEpE,eAAe,CAAC,KAAa,EAAE,GAAW,EAAW,EAAE,CACtD,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK;SACH,KAAK,CAAC,OAAO,CAAC;SACd,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/ensure",
|
|
3
|
-
"version": "21.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "21.3.0",
|
|
4
|
+
"gitHead": "c0bce295b8c1fbc4f692ec05fb760c8b157fb708",
|
|
5
5
|
"description": "Lint your commit messages",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"commitlint",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"pkg": "pkg-check"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@commitlint/types": "^21.
|
|
37
|
+
"@commitlint/types": "^21.3.0",
|
|
38
38
|
"es-toolkit": "^1.46.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|