提交规范
代码检查工具
-
Eslint
-
项目集成
npm i eslint -D npx eslint --init
代码风格工具
-
prettier
-
项目集成
npm i prettier eslint-config-prettier eslint-plugin-prettier -D
创建 .prettierrc
// 根据所需进行配置 { "semi": false, "tabWidth": 2, "trailingComma": "none", "singleQuote": true, "arrowParens": "avoid" }
git 提交代码规范
执行npm run commit
命令,根据提示流程选择本次提交类型和范围,进行代码提交流程
-
commitizen -- 辅助 commit 信息,规范提交信息
- commitizen -- cz-config 设置提交模板
提交规范配置
-- 规范配置,标识采用什么规范来执行消息校验, 这个默认是Angular的提交规范
类型 | 描述 |
---|---|
build | 编译相关的修改,例如发布版本、对项目构建或者依赖的改动 |
chore | 其他修改, 比如改变构建流程、或者增加依赖库、工具等 |
ci | 更改持续集成软件的配置文件和 package 中的 scripts 命令 |
docs | 文档修改 |
feat | 新需求、新功能 |
fix | 修改bug |
perf | 性能优化相关,比如提升性能、用户体验 |
refactor | 代码重构,代码优化 |
revert | 代码回退 |
style | 代码格式(不影响功能,例如空格、分号等格式修正) |