commitlint.config.cjs 4.3 KB

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