mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
1bdbc31039
- 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.
26 lines
880 B
JavaScript
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),
|
|
],
|
|
};
|