commitlint.config.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /**
  2. * feat:新增功能
  3. * fix:修复缺陷
  4. * docs:文档更新
  5. * style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
  6. * refactor:代码重构
  7. * perf:性能提升
  8. * test:测试相关
  9. * build:构建相关
  10. * ci:持续集成
  11. * chore:不属于以上类型的其他类型,比如构建流程, 依赖管理
  12. * revert:回退代码
  13. */
  14. /** @type {import('cz-git').UserConfig} */
  15. module.exports = {
  16. extends: ['@commitlint/config-conventional'],
  17. rules: {
  18. 'body-leading-blank': [2, 'always'],
  19. 'footer-leading-blank': [1, 'always'],
  20. 'subject-empty': [2, 'never'],
  21. 'type-empty': [2, 'never'],
  22. 'subject-case': [0, 'never'],
  23. 'type-enum': [
  24. 2,
  25. 'always',
  26. ['feat', 'fix', 'perf', 'style', 'docs', 'test', 'refactor', 'build', 'ci', 'chore', 'revert', 'release'],
  27. ],
  28. },
  29. prompt: {
  30. messages: {
  31. type: '选择你要提交的类型 :',
  32. scope: '选择一个提交范围(可选):',
  33. customScope: '请输入自定义的提交范围 :',
  34. subject: '填写简短精炼的变更描述 :\n',
  35. body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
  36. breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
  37. footerPrefixsSelect: '选择关联issue前缀(可选):',
  38. customFooterPrefixs: '输入自定义issue前缀 :',
  39. footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
  40. confirmCommit: '是否提交或修改commit ?',
  41. },
  42. types: [
  43. { value: 'feat', name: 'feat: 新增功能 | A new feature' },
  44. { value: 'fix', name: 'fix: 修复缺陷 | A bug fix' },
  45. { value: 'docs', name: 'docs: 文档更新 | Documentation only changes' },
  46. { value: 'style', name: 'style: 代码格式 | Changes that do not affect the meaning of the code' },
  47. { value: 'refactor', name: 'refactor: 代码重构 | A code change that neither fixes a bug nor adds a feature' },
  48. { value: 'perf', name: 'perf: 性能提升 | A code change that improves performance' },
  49. { value: 'test', name: 'test: 测试相关 | Adding missing tests or correcting existing tests' },
  50. { value: 'build', name: 'build: 构建相关 | Changes that affect the build system or external dependencies' },
  51. { value: 'ci', name: 'ci: 持续集成 | Changes to our CI configuration files and scripts' },
  52. { value: 'revert', name: 'revert: 回退代码 | Revert to a commit' },
  53. { value: 'chore', name: 'chore: 其他修改 | Other changes that do not modify src or test files' },
  54. ],
  55. useEmoji: false,
  56. emojiAlign: 'center',
  57. allowCustomIssuePrefixs: false,
  58. allowEmptyIssuePrefixs: false,
  59. },
  60. };