Skip to content

Commit

Permalink
build: Add commit-lint
Browse files Browse the repository at this point in the history
In order for the automatic release process VRPirates#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.
  • Loading branch information
MikeRatcliffe committed Sep 18, 2024
1 parent b8771fc commit 0b7971e
Show file tree
Hide file tree
Showing 5 changed files with 1,356 additions and 313 deletions.
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run commitlint ${1}
65 changes: 65 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* This commitlint config file extends the conventional configuration
* and adds the following customizations:
*
* - Ignores commit messages that start with "Merge"
* - Allows the following commit types:
* - build
* - chore
* - ci
* - docs
* - feat
* - fix
* - perf
* - refactor
* - revert
* - style
* - test
* - Merge
*
* Please see the commitlint documentation for more information on how to use
* this configuration file:
* https://commitlint.js.org/reference/rules.html
*
*/
const RuleConfigSeverity = {
Disabled: 0,
Warning: 1,
Error: 2,
};

module.exports = {
ignores: [(message) => message.startsWith("Merge")],
rules: {
"type-enum": [
2,
"always",
[
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
],
],
"body-case": [RuleConfigSeverity.Disabled, "always"],
"body-leading-blank": [RuleConfigSeverity.Warning, "always"],
"body-max-line-length": [RuleConfigSeverity.Disabled, "always"],
"footer-leading-blank": [RuleConfigSeverity.Warning, "always"],
"footer-max-line-length": [RuleConfigSeverity.Disabled, "always"],
"header-max-length": [RuleConfigSeverity.Disabled, "always"],
"header-trim": [RuleConfigSeverity.Error, "always"],
"scope-case": [RuleConfigSeverity.Error, "always", "lower-case"],
"subject-case": [RuleConfigSeverity.Disabled, "always"],
"subject-empty": [RuleConfigSeverity.Error, "never"],
"subject-full-stop": [RuleConfigSeverity.Error, "never", "."],
"type-case": [RuleConfigSeverity.Error, "always", "lower-case"],
"type-empty": [RuleConfigSeverity.Error, "never"],
},
};
Loading

0 comments on commit 0b7971e

Please sign in to comment.