Skip to content

Commit c1230e4

Browse files
committed
build: Add commit-lint
In order for the automatic release process #32 to work we need to ensure that we always use conventional commits in order for the changelog to be generated correctly. This patch ensures that this is the case.
1 parent e1159a5 commit c1230e4

5 files changed

Lines changed: 1356 additions & 313 deletions

File tree

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run commitlint ${1}

commitlint.config.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* This commitlint config file extends the conventional configuration
3+
* and adds the following customizations:
4+
*
5+
* - Ignores commit messages that start with "Merge"
6+
* - Allows the following commit types:
7+
* - build
8+
* - chore
9+
* - ci
10+
* - docs
11+
* - feat
12+
* - fix
13+
* - perf
14+
* - refactor
15+
* - revert
16+
* - style
17+
* - test
18+
* - Merge
19+
*
20+
* Please see the commitlint documentation for more information on how to use
21+
* this configuration file:
22+
* https://commitlint.js.org/reference/rules.html
23+
*
24+
*/
25+
const RuleConfigSeverity = {
26+
Disabled: 0,
27+
Warning: 1,
28+
Error: 2,
29+
};
30+
31+
module.exports = {
32+
ignores: [(message) => message.startsWith("Merge")],
33+
rules: {
34+
"type-enum": [
35+
2,
36+
"always",
37+
[
38+
"build",
39+
"chore",
40+
"ci",
41+
"docs",
42+
"feat",
43+
"fix",
44+
"perf",
45+
"refactor",
46+
"revert",
47+
"style",
48+
"test",
49+
],
50+
],
51+
"body-case": [RuleConfigSeverity.Disabled, "always"],
52+
"body-leading-blank": [RuleConfigSeverity.Warning, "always"],
53+
"body-max-line-length": [RuleConfigSeverity.Disabled, "always"],
54+
"footer-leading-blank": [RuleConfigSeverity.Warning, "always"],
55+
"footer-max-line-length": [RuleConfigSeverity.Disabled, "always"],
56+
"header-max-length": [RuleConfigSeverity.Disabled, "always"],
57+
"header-trim": [RuleConfigSeverity.Error, "always"],
58+
"scope-case": [RuleConfigSeverity.Error, "always", "lower-case"],
59+
"subject-case": [RuleConfigSeverity.Disabled, "always"],
60+
"subject-empty": [RuleConfigSeverity.Error, "never"],
61+
"subject-full-stop": [RuleConfigSeverity.Error, "never", "."],
62+
"type-case": [RuleConfigSeverity.Error, "always", "lower-case"],
63+
"type-empty": [RuleConfigSeverity.Error, "never"],
64+
},
65+
};

0 commit comments

Comments
 (0)