Skip to content

Commit

Permalink
fix: Config commitlint file with .mjs extension (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima authored Jun 15, 2024
1 parent 1cb9aa1 commit 4b08f23
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 27 deletions.
24 changes: 0 additions & 24 deletions .github/commitlint.config.js

This file was deleted.

46 changes: 46 additions & 0 deletions .github/commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Defined rules on commit messages that are checked on pull requests.

// See the documentation for reference rules: https://commitlint.js.org/#/reference-rules

// These rules are used to check if the commit message contains a type. The type is the first word
// in the commit message and must match one of the types defined in the `typesRule` array in this
// configuration file.

/** The array of rule types that are allowed in commit messages */
const typesRule = [
"build",
"chore",
"ci",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test",
];

/** The array of rule subjects that are allowed in commit messages */
const subjectsRule = ["upper-case", "pascal-case", "sentence-case", "start-case"];

/** The rules configuration for commitlint that is used in GitHub Workflow Actions */
const commitlintConfig = {
rules: {
"type-enum": [2, "always", typesRule],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"scope-case": [2, "always", "kebab-case"],
"subject-case": [2, "always", "sentence-case"],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 80],
"body-case": [2, "always", "sentence-case"],
"body-leading-blank": [2, "always"],
"body-max-line-length": [1, "always", 100],
"footer-leading-blank": [2, "always"],
"footer-max-line-length": [1, "always", 100],
},
};

export default commitlintConfig;
6 changes: 3 additions & 3 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint Commit Messages
name: Linting Commit Messages

on: [pull_request]

Expand All @@ -18,6 +18,6 @@ jobs:
fetch-depth: 0

- name: Run commitlint
uses: wagoid/commitlint-github-action@v5
uses: wagoid/commitlint-github-action@v6
with:
configFile: .github/commitlint.config.js
configFile: .github/commitlint.config.mjs

0 comments on commit 4b08f23

Please sign in to comment.