Skip to content

Add lenient commit message linter with commitlint #48

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Jerek0
Copy link
Member

@Jerek0 Jerek0 commented Jun 30, 2025

Add lenient commit message linter with commitlint

This PR introduces a lightweight and opinionated commitlint setup. The goal is to gently encourage more descriptive and meaningful commit messages, without enforcing strict Conventional Commits or requiring type prefixes like feat: or fix:.

🧠 Why?

Commit messages are an essential part of project history. By enforcing a few light rules, we can:

  • Improve readability in tools like git log, GitHub, and Git clients
  • Encourage better collaboration and long-term project understanding
  • Avoid throwaway commits like wip, qa, or fix that lack context

This linter is here to help, not get in the way.

🔧 What it enforces

Rule Description
subject is required No empty messages allowed
✅ Minimum 3 words Avoids vague one-word messages
✅ Length between 5–100 chars Enough space to be clear, but concise
🚫 No trailing period Keeps subject lines short and to the point
🆗 Body is optional If present, must start with a blank line and wrap lines at 120 characters

Tip

If 100 characters isn’t enough to describe your change, keep the subject short and clear, then use the commit body to provide additional context/information.

🛠️ How it works

  1. When running git commit, a commit-msg hook triggers commitlint on the last commit message
  2. The message is validated against our config
  3. If the message fails any error-level rules, the commit is blocked with an explanation. Otherwise, it silently goes through as usual

This is powered by simple-git-hooks, which runs commitlint automatically at commit time.

Example

image

@Jerek0 Jerek0 requested review from mcaskill, arnvvd and devenini June 30, 2025 22:05
@Jerek0 Jerek0 added the enhancement New feature or request label Jun 30, 2025
Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
astro-boilerplate ✅ Ready (Inspect) Visit Preview Jul 3, 2025 5:49pm

@Jerek0 Jerek0 requested review from a team and removed request for mcaskill, arnvvd and devenini June 30, 2025 22:05
@devenini
Copy link
Member

devenini commented Jul 3, 2025

Possible to convert commitlint.config.js to TypeScript (.ts) so it’s consistent with the other JavaScript files in the repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants