{"id":27304178,"url":"https://github.com/stacksjs/gitlint","last_synced_at":"2026-05-08T02:29:57.256Z","repository":{"id":287475793,"uuid":"964821111","full_name":"stacksjs/gitlint","owner":"stacksjs","description":"Minimal \u0026 fast Git commit message linting \u0026 formatting.","archived":false,"fork":false,"pushed_at":"2025-04-12T00:09:06.000Z","size":671,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T00:22:41.682Z","etag":null,"topics":["cli","commit-message","formatter","git","library","linter","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stacksjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["stacksjs","chrisbbreuer"],"open_collective":"stacksjs"}},"created_at":"2025-04-11T21:01:48.000Z","updated_at":"2025-04-12T00:10:00.000Z","dependencies_parsed_at":"2025-04-12T00:22:46.302Z","dependency_job_id":"bc873849-4c16-4ad9-8437-1066c0b0199d","html_url":"https://github.com/stacksjs/gitlint","commit_stats":null,"previous_names":["stacksjs/gitlint"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fgitlint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fgitlint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fgitlint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stacksjs%2Fgitlint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stacksjs","download_url":"https://codeload.github.com/stacksjs/gitlint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248510705,"owners_count":21116253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","commit-message","formatter","git","library","linter","typescript"],"created_at":"2025-04-12T03:22:52.373Z","updated_at":"2026-05-08T02:29:57.248Z","avatar_url":"https://github.com/stacksjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/stacksjs","https://github.com/sponsors/chrisbbreuer","https://opencollective.com/stacksjs"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\".github/art/cover.jpg\" alt=\"Social Card of this repo\"\u003e\u003c/p\u003e\n\n[![npm version][npm-version-src]][npm-version-href]\n[![GitHub Actions][github-actions-src]][github-actions-href]\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n\u003c!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] --\u003e\n\u003c!-- [![Codecov][codecov-src]][codecov-href] --\u003e\n\n# GitLint\n\n\u003e Efficient Git Commit Message Linting and Formatting\n\nGitLint is a tool for enforcing consistent Git commit message conventions. It analyzes commit messages to ensure they follow the [Conventional Commits](https://www.conventionalcommits.org/) specification and other configurable rules.\n\n## Installation\n\n```bash\n# Install globally\nnpm install -g @stacksjs/gitlint\n\n# Or using bun\nbun install -g @stacksjs/gitlint\n```\n\n_We are looking to get it published as `gitlint` on npm, but it's not allowing us to do so due to `git-lint`. Please npm 🙏🏽_\n\n## Usage\n\n### CLI\n\n```bash\n# Check a commit message from a file\ngitlint path/to/commit-message.txt\n\n# Use with git commit message hook (common use case)\ngitlint --edit $1\n\n# Show help\ngitlint --help\n```\n\n### Git Hooks Integration\n\nGitLint can automatically install Git hooks for your repository:\n\n```bash\n# Install the commit-msg hook\ngitlint hooks --install\n\n# Force overwrite if a hook already exists\ngitlint hooks --install --force\n\n# Uninstall the hooks\ngitlint hooks --uninstall\n```\n\nOr manually add to your `.git/hooks/commit-msg` file:\n\n```bash\n# !/bin/sh\ngitlint --edit \"$1\"\n```\n\nOr use with [husky](https://github.com/typicode/husky):\n\n```jsonc\n// package.json\n{\n  \"husky\": {\n    \"hooks\": {\n      \"commit-msg\": \"gitlint --edit $HUSKY_GIT_PARAMS\"\n    }\n  }\n}\n```\n\n## Configuration\n\nCreate a `gitlint.config.js` file in your project root:\n\n```js\n// gitlint.config.js\nmodule.exports = {\n  verbose: true,\n  rules: {\n    'conventional-commits': 2,\n    'header-max-length': [2, { maxLength: 72 }],\n    'body-max-line-length': [2, { maxLength: 100 }],\n    'body-leading-blank': 2,\n    'no-trailing-whitespace': 1\n  },\n  ignores: [\n    '^Merge branch',\n    '^Merge pull request'\n  ]\n}\n```\n\n### Rule Levels\n\n- `0` or `off`: Disable the rule\n- `1` or `warning`: Warning (doesn't cause exit code to be non-zero)\n- `2` or `error`: Error (causes exit code to be non-zero)\n\n## Built-in Rules\n\n- `conventional-commits`: Enforces conventional commit format (`\u003ctype\u003e(scope): description`)\n- `header-max-length`: Enforces a maximum header length\n- `body-max-line-length`: Enforces a maximum body line length\n- `body-leading-blank`: Enforces a blank line between header and body\n- `no-trailing-whitespace`: Checks for trailing whitespace\n\n## Programmatic Usage\n\n```js\nimport { lintCommitMessage, parseCommitMessage } from '@stacksjs/gitlint'\n\n// Lint a commit message\nconst result = lintCommitMessage('feat: add new feature')\nconsole.log(result.valid) // true or false\nconsole.log(result.errors) // array of error messages\nconsole.log(result.warnings) // array of warning messages\n\n// Parse a commit message\nconst parsed = parseCommitMessage('feat(scope): description\\n\\nBody text\\n\\nCloses #123')\nconsole.log(parsed.type) // 'feat'\nconsole.log(parsed.scope) // 'scope'\nconsole.log(parsed.references) // [{issue: '123', ...}]\n```\n\n## Testing\n\n```bash\nbun test\n```\n\n## Changelog\n\nPlease see our [releases](https://github.com/stackjs/gitlint/releases) page for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Community\n\nFor help, discussion about best practices, or any other conversation that would benefit from being searchable:\n\n[Discussions on GitHub](https://github.com/stacksjs/gitlint/discussions)\n\nFor casual chit-chat with others using this package:\n\n[Join the Stacks Discord Server](https://discord.gg/stacksjs)\n\n## Postcardware\n\n“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.\n\nOur address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎\n\n## Sponsors\n\nWe would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.\n\n- [JetBrains](https://www.jetbrains.com/)\n- [The Solana Foundation](https://solana.com/)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.\n\nMade with 💙\n\n\u003c!-- Badges --\u003e\n[npm-version-src]: https://img.shields.io/npm/v/@stacksjs/gitlint?style=flat-square\n[npm-version-href]: https://npmjs.com/package/@stacksjs/gitlint\n[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/gitlint/ci.yml?style=flat-square\u0026branch=main\n[github-actions-href]: https://github.com/stacksjs/gitlint/actions?query=workflow%3Aci\n\n\u003c!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/gitlint/main?style=flat-square\n[codecov-href]: https://codecov.io/gh/stacksjs/gitlint --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fgitlint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstacksjs%2Fgitlint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstacksjs%2Fgitlint/lists"}