commitlint.config.cjs 4.0 KB

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