Files
vercel__chat/commitlint.config.js
Ben Sabic 1bdbc31039 chore: integrate commitlint to enforce Conventional Commits
- Add @commitlint/cli and @commitlint/config-conventional (pinned to 21.0.0)
  and husky as root devDependencies.
- commitlint.config.js extends config-conventional, allows free-form scopes,
  and ignores auto-generated Merge / Revert commits.
- .husky/commit-msg runs commitlint on every local commit; husky installs
  automatically via the `prepare` script on `pnpm install`.
- New `commitlint` CI job in .github/workflows/ci.yml lints PR commits
  (--from base.sha --to head.sha) and the most recent commit on direct
  pushes to main (--last). SHAs are passed via `env:` rather than direct
  `${{ … }}` interpolation to avoid the script-injection class of bug.
- CI uses `pnpm install --frozen-lockfile`, so the commitlint binary that
  runs is exactly the version pinned in pnpm-lock.yaml.
- .github/CONTRIBUTING.md documents the local hook + CI enforcement.
2026-05-12 21:56:44 +10:00

26 lines
880 B
JavaScript

/**
* commitlint config — enforces Conventional Commits.
*
* Scopes are intentionally free-form so contributors can use package names
* (`slack`, `teams`, `release`, etc.) or any other relevant scope.
*
* See .github/CONTRIBUTING.md → "Commit messages" for the contributor guide.
*/
const MERGE_COMMIT = /^Merge /;
const REVERT_COMMIT = /^Revert /;
export default {
extends: ["@commitlint/config-conventional"],
rules: {
// Conventional's default already permits `lower-case` and `sentence-case`
// (so `chore(release): version packages` passes); make it explicit here.
"subject-case": [2, "never", ["start-case", "pascal-case", "upper-case"]],
},
ignores: [
// Skip auto-generated merge/revert commits which don't follow Conventional Commits.
(message) => MERGE_COMMIT.test(message),
(message) => REVERT_COMMIT.test(message),
],
};