简要约定式提交
规范化
- 前端规范文档
- commitizen + husky + commitlint
- 约定式提交
- element plus
- Vue github
- Prettier Options
- ESLint Rules
- Airbnb Style Guide
- commitizen
- husky
- commitlint
npx install-peerdeps --dev eslint-config-airbnb | npm下载airbnb
Install ESLint & Prettier extensions for VSCode
Optional - Set format on save and any global prettier optionsInstall Packages
npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-nodenpx install-peerdeps --dev eslint-config-airbnbCreate
.prettierrcfor any prettier rules (semicolons, quotes, etc)Create
.eslintrc.jsonfile
You can generate witheslint --initif you install eslint globally
{
"extends": ["airbnb", "prettier", "plugin:node/recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"no-unused-vars": "warn",
"no-console": "off",
"func-names": "off",
"no-process-exit": "off",
"object-shorthand": "off",
"class-methods-use-this": "off"
}
}提交规范
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]类型(type)
feat:: 类型为 feat 的提交表示在代码库中新增了一个功能(这和语义化版本中的 MINOR 相对应)。 fix::类型为 fix 的 提交表示在代码库中修复了一个 bug (这和语义化版本中的 PATCH 相对应)。 docs:: 只是更改文档。 style:: 不影响代码含义的变化(空白、格式化、缺少分号等)。 refactor:: 代码重构,既不修复错误也不添加功能。 perf:: 改进性能的代码更改。 test:: 添加确实测试或更正现有的测试。 build:: 影响构建系统或外部依赖关系的更改(示例范围:gulp、broccoli、NPM)。 ci:: 更改持续集成文件和脚本(示例范围:Travis、Circle、BrowserStack、SauceLabs)。 chore:: 其他不修改src或test文件。 revert:: commit 回退。
范围(scope)
为提交类型添加一个围在圆括号内的作用域,以为其提供额外的上下文信息。例如 feat(parser): adds ability to parse arrays.