.commitlintrc.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // .commitlintrc.js
  2. /** @type {import('cz-git').UserConfig} */
  3. export default {
  4. ignores: [commit => commit.includes('init')],
  5. extends: ['@commitlint/config-conventional'],
  6. rules: {
  7. 'header-max-length': [2, 'always', 120],
  8. 'scope-case': [2, 'always', ['lowerCase', 'uppercase']],
  9. 'subject-empty': [2, 'never'],
  10. 'subject-case': [
  11. 2,
  12. 'always',
  13. ['lower-case', 'sentence-case', 'start-case', 'pascal-case', 'upper-case']
  14. ],
  15. 'subject-full-stop': [2, 'never', '.'],
  16. 'type-empty': [2, 'never'],
  17. 'type-case': [2, 'always', 'lowerCase'],
  18. 'type-enum': [
  19. 2,
  20. 'always',
  21. ['feat', 'fix', 'docs', 'style', 'perf', 'chore', 'build', 'refactor']
  22. ]
  23. },
  24. prompt: {
  25. messages: {
  26. type: '选择你要提交的类型 :',
  27. scope: '选择一个提交范围(可选):',
  28. customScope: '请输入自定义的提交范围 :',
  29. subject: '填写简短精炼的变更描述 :\n',
  30. body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
  31. breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
  32. footerPrefixsSelect: '选择关联issue前缀(可选):',
  33. customFooterPrefixs: '输入自定义issue前缀 :',
  34. footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
  35. confirmCommit: '是否提交或修改commit ?'
  36. },
  37. types: [
  38. {
  39. value: 'feat',
  40. name: 'feat: 新增功能',
  41. emoji: '✨'
  42. },
  43. {
  44. value: 'fix',
  45. name: 'fix: 修复缺陷',
  46. emoji: '🧩'
  47. },
  48. {
  49. value: 'docs',
  50. name: 'docs: 文档变更',
  51. emoji: '📚'
  52. },
  53. {
  54. value: 'style',
  55. name: 'style: 代码格式(不影响功能,例如空格、分号等格式修正)',
  56. emoji: '🎨'
  57. },
  58. {
  59. value: 'refactor',
  60. name: 'refactor: 代码重构(不包括 bug 修复、功能新增)',
  61. emoji: '♻️'
  62. },
  63. {
  64. value: 'perf',
  65. name: 'perf: 性能优化',
  66. emoji: '⚡️'
  67. },
  68. {
  69. value: 'test',
  70. name: 'test: 添加疏漏测试或已有测试改动',
  71. emoji: '✅'
  72. },
  73. {
  74. value: 'revert',
  75. name: 'revert: 回滚 commit',
  76. emoji: '⏪️'
  77. },
  78. {
  79. value: 'build',
  80. name: 'build: 项目打包发布',
  81. emoji: ' 🚀'
  82. },
  83. {
  84. value: 'chore',
  85. name: 'chore: 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)',
  86. emoji: '🔨'
  87. }
  88. ],
  89. useEmoji: true,
  90. emojiAlign: 'center',
  91. themeColorCode: '38;5;119',
  92. scopes: [
  93. {
  94. value: '业务功能',
  95. name: 'aps: 系统业务'
  96. },
  97. {
  98. value: '功能优化',
  99. name: 'perf: 优化相关'
  100. },
  101. {
  102. value: 'bug修复',
  103. name: 'bug: bug相关'
  104. }
  105. ],
  106. allowCustomScopes: true,
  107. allowEmptyScopes: false,
  108. customScopesAlign: 'bottom',
  109. customScopesAlias: 'custom',
  110. emptyScopesAlias: 'empty',
  111. upperCaseSubject: false,
  112. allowBreakingChanges: ['feat', 'fix'],
  113. breaklineNumber: 100,
  114. breaklineChar: '|',
  115. skipQuestions: ['body', 'breaking'],
  116. issuePrefixs: [
  117. {
  118. value: 'fixed',
  119. name: 'reference: ISSUES has been fixed'
  120. }
  121. ],
  122. customIssuePrefixsAlign: 'top',
  123. emptyIssuePrefixsAlias: 'skip',
  124. customIssuePrefixsAlias: 'custom',
  125. allowCustomIssuePrefixs: true,
  126. allowEmptyIssuePrefixs: true,
  127. confirmColorize: true,
  128. maxHeaderLength: 150,
  129. maxSubjectLength: 120,
  130. minSubjectLength: 2,
  131. scopeOverrides: undefined,
  132. defaultBody: '',
  133. defaultIssues: '',
  134. defaultScope: '',
  135. defaultSubject: ''
  136. }
  137. };