Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Config commitlint file with .mjs extension #98

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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