@2030/commitlint-config-plus
v1.0.1
Published
ZiJun's commitlint config for work projects
Downloads
24
Readme
:sparkles:@2030/commitlint-config-plus
代码提交规则标准规范
:fire:风格说明
- 标题不能为空且不得超过72个字符
- Scope不能为空
- 规范标准提交类型
- 默认提交类型
- 'feat' // 新增功能/特性
- 'fix' // 修复BUG/问题
- 'upd' // 更新某功能
- 'docs' // 变更文档/注释
- 'style' // 调整代码格式(不影响功能,空格/分号等格式修正)
- 'types', // 类型声明或修改
- 'refactor' // 重构代码(不包括修复BUG/新增功能)
- 'perf' // 优化/性能提升
- 'test' // 测试(用例)相关
- 'workflow' // 构建流程/工具变更(修改打包配置等)
- 'ci' // 持续集成
- 'revert' // 回滚提交
- 'merge' // 合并分支
- 'chore' // 依赖更新/脚手架配置修改
- 'wip' // 开发中
- 'mod' // 不确定分类的修改
- 'release' // 发布新版本
:bulb:使用说明
1. 安装
npm
安装:> npm i -D @commitlint/cli @2030/commitlint-config-plus
yarn
安装:> yarn add -D @commitlint/cli @2030/commitlint-config-plus
pnpm
安装:> pnpm add -D @commitlint/cli @2030/commitlint-config-plus
2. 项目根目录配置
.commitlintrc.json
配置:{ "extends": ["@2030/commitlint-config-plus"] }
.commitlintrc.yml
配置:extends: "@2030/commitlint-config-plus"
.commitlintrc.js
配置:module.exports = { extends: ["@2030/commitlint-config-plus"] }
3. 添加 husky
hook - commit-msg
Husky V8 代码示例:
# husky初始化
pnpm dlx husky-init
# 安装依赖,默认添加 pre-commit 钩子,可选择注释内容
pnpm install
- 非window端添加
commit-msg
钩子npx husky add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
- window端添加
commit-msg
钩子node node_modules/husky/lib/bin add .husky/commit-msg 'npx --no -- commitlint --edit "$1"'
:key:License
MIT License © 2022 ZiJun