@ethima/commitlint-config 1.0.0 → 1.1.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 +23 -16
- package/package.json +6 -6
- package/src/index.js +16 -2
package/README.md
CHANGED
|
@@ -10,22 +10,28 @@ adjustments as detailed below.
|
|
|
10
10
|
|
|
11
11
|
### More lenient rules regarding long lines in bodies and footers
|
|
12
12
|
|
|
13
|
-
When referencing URIs in commit messages
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
13
|
+
When referencing URIs in commit messages it is trivial to trigger the
|
|
14
|
+
`{body,footer}-max-line-length` rules. This is a common scenario when
|
|
15
|
+
referencing code, commits, etc. on source hosting platforms.
|
|
16
|
+
|
|
17
|
+
One scenario in which long URIs in a commit message are common are release
|
|
18
|
+
commits of the semantic release process. Specifically linking to source commits
|
|
19
|
+
for changelog entries, see [the initial release of this configuration for an
|
|
20
|
+
example][ethima-commitlint-config-initial-release-commit-url]. These commits,
|
|
21
|
+
assumed to have a header of the form `build|chore(release): v<x.y.z>`, are
|
|
22
|
+
exempt from any checks.
|
|
23
|
+
|
|
24
|
+
Other long URI references can be included in commit messages by writing them as
|
|
25
|
+
Markdown footnotes, e.g. `[^1]: <long URI>`, `[^named-footnote]: <long URI>` at
|
|
26
|
+
the end of the commit message and referencing them from the body. Most hosting
|
|
27
|
+
platforms will render these footnotes with proper links, etc. in various places
|
|
28
|
+
in their UI. To support this functionality, this configuration replaces the
|
|
29
|
+
`{body,footer}-max-line-length` rules with the
|
|
30
|
+
`{body,footer}-max-line-length-with-footnote-exemption` rules. Apart from the
|
|
31
|
+
exemption, these rules behave the same as the original rules and accept the
|
|
32
|
+
same configuration. Both the `body-` and `footer-` rules are replaced as some
|
|
33
|
+
URIs may trigger the footer detection in the commit message parser,
|
|
34
|
+
particularly when a URI includes a `#`.
|
|
29
35
|
|
|
30
36
|
### Stricter rules on merge and `fixup!`/`squash!` commits
|
|
31
37
|
|
|
@@ -54,4 +60,5 @@ into (pre)release branches.
|
|
|
54
60
|
[commitlint-is-ignored-wildcards-url]: https://github.com/conventional-changelog/commitlint/blob/3bc4726f0dddfa051bc75f6af7b7ca076b04a839/%40commitlint/is-ignored/src/defaults.ts#L17-L29
|
|
55
61
|
[commitlint-url]: https://commitlint.js.org
|
|
56
62
|
[conventional-commits-url]: https://conventionalcommits.org/
|
|
63
|
+
[ethima-commitlint-config-initial-release-commit-url]: https://gitlab.com/ethima/commitlint-config/-/commit/3c32023a5647f8bf4090e1158a3d1f4fa9279324
|
|
57
64
|
[ethima-url]: https://gitlab.com/ethima/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethima/commitlint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A shareable Commitlint configuration for the Ethima organization",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://gitlab.com/ethima/commitlint-config",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@commitlint/config-conventional": "18.
|
|
26
|
-
"@commitlint/is-ignored": "18.
|
|
25
|
+
"@commitlint/config-conventional": "18.4.3",
|
|
26
|
+
"@commitlint/is-ignored": "18.4.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@commitlint/lint": "18.
|
|
30
|
-
"@commitlint/load": "18.
|
|
31
|
-
"ava": "
|
|
29
|
+
"@commitlint/lint": "18.4.3",
|
|
30
|
+
"@commitlint/load": "18.4.3",
|
|
31
|
+
"ava": "6.0.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,12 @@ const {
|
|
|
5
5
|
|
|
6
6
|
const footnoteMatcher = new RegExp("^\\[\\^.+?\\]:");
|
|
7
7
|
|
|
8
|
+
// Matches the header of commits representing semantic releases
|
|
9
|
+
const semanticReleaseCommitMatcher = new RegExp(
|
|
10
|
+
"^(build|chore)\\(release\\):\\s*v?\\d+(\\.\\d+){2}.*$",
|
|
11
|
+
"m",
|
|
12
|
+
);
|
|
13
|
+
|
|
8
14
|
// When referencing URIs in commit messages, it is very common to hit
|
|
9
15
|
// `max-line-length` restrictions. As a work-around, these URIs may be added as
|
|
10
16
|
// Markdown footnotes which can then be detected and given an exemption
|
|
@@ -37,18 +43,26 @@ const buildMaxLineLengthWithFootnoteExemption = (section) => {
|
|
|
37
43
|
//
|
|
38
44
|
// Instead of duplicating these function definitions, it is more
|
|
39
45
|
// straightforward to obtain them from the defaults
|
|
40
|
-
const
|
|
46
|
+
const applicableDefaultIgnoreFunctions = defaultIgnoreFunctions.filter(
|
|
41
47
|
(ignoreFunction) =>
|
|
42
48
|
ignoreFunction("Revert ") || ignoreFunction("Merge 'x' into 'y' "),
|
|
43
49
|
);
|
|
44
50
|
|
|
51
|
+
// Ignore functions specific to this commitlint configuration
|
|
52
|
+
const configurationSpecificIgnoreFunctions = [
|
|
53
|
+
semanticReleaseCommitMatcher.test.bind(semanticReleaseCommitMatcher),
|
|
54
|
+
];
|
|
55
|
+
|
|
45
56
|
module.exports = {
|
|
46
57
|
// Do not use the default ignore patterns as they allow patterns, e.g.
|
|
47
58
|
// `fixup!` and `squash!` commits, that should be blocked in the workflows
|
|
48
59
|
// primarily supported by this configuration
|
|
49
60
|
defaultIgnores: false,
|
|
50
61
|
extends: ["@commitlint/config-conventional"],
|
|
51
|
-
ignores
|
|
62
|
+
ignores: [
|
|
63
|
+
...applicableDefaultIgnoreFunctions,
|
|
64
|
+
...configurationSpecificIgnoreFunctions,
|
|
65
|
+
],
|
|
52
66
|
plugins: [
|
|
53
67
|
{
|
|
54
68
|
rules: {
|