You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.9 KiB

1 week ago
  1. /**
  2. * commitlint 配置文件
  3. * 文档
  4. * https://commitlint.js.org/#/reference-rules
  5. * https://cz-git.qbb.sh/zh/guide/
  6. */
  7. module.exports = {
  8. // 继承的规则
  9. extends: ['@commitlint/config-conventional'],
  10. // 自定义规则
  11. rules: {
  12. // 提交类型枚举,git提交type必须是以下类型
  13. 'type-enum': [
  14. 2,
  15. 'always',
  16. [
  17. 'feat', // 新增功能
  18. 'fix', // 修复缺陷
  19. 'docs', // 文档变更
  20. 'style', // 代码格式(不影响功能,例如空格、分号等格式修正)
  21. 'refactor', // 代码重构(不包括 bug 修复、功能新增)
  22. 'perf', // 性能优化
  23. 'test', // 添加疏漏测试或已有测试改动
  24. 'build', // 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)
  25. 'ci', // 修改 CI 配置、脚本
  26. 'revert', // 回滚 commit
  27. 'chore', // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
  28. 'wip' // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
  29. ]
  30. ],
  31. 'subject-case': [0] // subject大小写不做校验
  32. },
  33. prompt: {
  34. messages: {
  35. type: '选择你要提交的类型 :',
  36. scope: '选择一个提交范围(可选):',
  37. customScope: '请输入自定义的提交范围 :',
  38. subject: '填写简短精炼的变更描述 :\n',
  39. body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
  40. breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
  41. footerPrefixesSelect: '选择关联issue前缀(可选):',
  42. customFooterPrefix: '输入自定义issue前缀 :',
  43. footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
  44. generatingByAI: '正在通过 AI 生成你的提交简短描述...',
  45. generatedSelectByAI: '选择一个 AI 生成的简短描述:',
  46. confirmCommit: '是否提交或修改commit ?'
  47. },
  48. // prettier-ignore
  49. types: [
  50. { value: "feat", name: "特性: 新增功能" },
  51. { value: "fix", name: "修复: 修复缺陷" },
  52. { value: "docs", name: "文档: 文档变更(更新README文件,或者注释)" },
  53. { value: "style", name: "格式: 代码格式(空格、格式化、缺失的分号等)" },
  54. { value: "refactor", name: "重构: 代码重构(不修复错误也不添加特性的代码更改)" },
  55. { value: "perf", name: "性能: 性能优化" },
  56. { value: "test", name: "测试: 添加疏漏测试或已有测试改动" },
  57. { value: "build", name: "构建: 构建流程、外部依赖变更(如升级 npm 包、修改 vite 配置等)" },
  58. { value: "ci", name: "集成: 修改 CI 配置、脚本" },
  59. { value: "revert", name: "回退: 回滚 commit" },
  60. { value: "chore", name: "其他: 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)" },
  61. ],
  62. useEmoji: true,
  63. emojiAlign: 'center',
  64. useAI: false,
  65. aiNumber: 1,
  66. themeColorCode: '',
  67. scopes: [],
  68. allowCustomScopes: true,
  69. allowEmptyScopes: true,
  70. customScopesAlign: 'bottom',
  71. customScopesAlias: 'custom',
  72. emptyScopesAlias: 'empty',
  73. upperCaseSubject: false,
  74. markBreakingChangeMode: false,
  75. allowBreakingChanges: ['feat', 'fix'],
  76. breaklineNumber: 100,
  77. breaklineChar: '|',
  78. skipQuestions: ['breaking', 'footerPrefix', 'footer'], // 跳过的步骤
  79. issuePrefixes: [{ value: 'closed', name: 'closed: ISSUES has been processed' }],
  80. customIssuePrefixAlign: 'top',
  81. emptyIssuePrefixAlias: 'skip',
  82. customIssuePrefixAlias: 'custom',
  83. allowCustomIssuePrefix: true,
  84. allowEmptyIssuePrefix: true,
  85. confirmColorize: true,
  86. maxHeaderLength: Infinity,
  87. maxSubjectLength: Infinity,
  88. minSubjectLength: 0,
  89. scopeOverrides: undefined,
  90. defaultBody: '',
  91. defaultIssues: '',
  92. defaultScope: '',
  93. defaultSubject: ''
  94. }
  95. }