UNPKG

@quicksand-cloud/commitlint-config

Version:

QuickSand Cloud Commitlint 配置 - 企业级 Git 提交信息规范化配置,支持中英文提示和 Conventional Commits 规范

143 lines (98 loc) 3 kB
# @quicksand-cloud/commitlint-config QuickSand Cloud 的 Commitlint 配置包,用于规范化 Git 提交信息格式。 ## 📦 安装 ```bash npm install --save-dev @quicksand-cloud/commitlint-config ``` ## 🚀 使用方法 ### 基本使用 在项目根目录创建 `commitlint.config.js` 文件: ```javascript export default { extends: ['@quicksand-cloud/commitlint-config'], }; ``` ### 中文版本 如果你希望使用中文提示信息,可以使用中文配置: ```javascript export default { extends: ['@quicksand-cloud/commitlint-config/zh-CN'], }; ``` ## ⚙️ 配置详情 ### 提交类型 支持以下提交类型: - **feat**: ✨ 新功能 - **fix**: 🐛 错误修复 - **docs**: 📚 文档变更 - **style**: 💎 代码风格变更(不影响功能) - **refactor**: 📦 代码重构 - **perf**: 🚀 性能优化 - **test**: 🚨 测试相关 - **build**: 🛠 构建系统或依赖变更 - **ci**: ⚙️ CI/CD 相关变更 - **chore**: ♻️ 其他变更 - **revert**: 🗑 回滚变更 ### 提交规范 - 标题长度限制:100 字符 - 正文每行长度限制:100 字符 - 必须包含提交类型 - 主题不能为空且不能以句号结尾 - 类型必须为小写 ### 示例 ```bash feat: 添加用户登录功能 详细描述用户登录功能的实现,包括: - 登录表单验证 - 密码加密处理 - 登录状态管理 Closes #123 ``` ## 🛠 与其他工具集成 ### 与 Commitizen 集成 1. 安装 Commitizen: ```bash npm install --save-dev commitizen ``` 2.`package.json` 中添加配置: ```json { "config": { "commitizen": { "path": "@commitlint/cz-commitlint" } } } ``` 3. 使用 Commitizen 提交: ```bash npx cz ``` ### 与 Husky 集成 1. 安装 Husky: ```bash npm install --save-dev husky ``` 2. 初始化 Husky: ```bash npx husky init ``` 3. 添加 commit-msg 钩子: ```bash echo "npx --no-install commitlint --edit \$1" > .husky/commit-msg ``` ## 📋 依赖要求 - `@commitlint/cli` >= 19.0.0 - `commitizen` >= 4.0.0 (可选,用于交互式提交) ## 🔄 与其他配置包的关系 本配置包是 QuickSand Cloud Specs 配置集合的一部分,建议与以下包配合使用: - [@quicksand-cloud/prettier-config](https://www.npmjs.com/package/@quicksand-cloud/prettier-config) - 代码格式化 - [@quicksand-cloud/oxlint-config](https://www.npmjs.com/package/@quicksand-cloud/oxlint-config) - 代码质量检查 - [@quicksand-cloud/typescript-config](https://www.npmjs.com/package/@quicksand-cloud/typescript-config) - TypeScript 配置 - [@quicksand-cloud/lint-staged-config](https://www.npmjs.com/package/@quicksand-cloud/lint-staged-config) - Git 提交前处理 - [@quicksand-cloud/specs](https://www.npmjs.com/package/@quicksand-cloud/specs) - 配置管理工具 ## 📄 许可证 MIT ## 🔗 相关链接 - [Commitlint 官方文档](https://commitlint.js.org/) - [Conventional Commits 规范](https://www.conventionalcommits.org/)