suerprisePlus
2024-05-30 7452857e6eb0d23dbd71a29f25985ada5208f25d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// # 提交信息规范:feat: 使用git提交新规范
// # 注意:后面有空格,类型见下表
// git commit -m "feat: 使用git提交新规范"
 
module.exports = {
  // 继承的规则
  extends: ['@commitlint/config-conventional'],
  // 定义规则类型
  rules: {
    // type 类型定义,表示 git 提交的 type 必须在以下类型范围内
    'type-enum': [
      2,
      'always',
      // # 注意:后面有空格,类型见下表
      // git commit -m "feat: 使用git提交新规范"
      [
        'feat', // 新功能 feature
        'fix', // 修复 bug
        'docs', // 文档注释
        'style', // 代码格式(不影响代码运行的变动)
        'refactor', // 重构(既不增加新功能,也不是修复bug)
        'perf', // 优化
        'test', // 增加测试
        'merge', // 分支合并
        'rebase', // 分支修正
        'revert', // 回退
        'build', // 打包
        'ci', // 持续集成
        'chore' // 其他
      ]
    ],
    // subject 大小写不做校验
    'subject-case': [0]
  },
  prompt: {
    settings: {},
    messages: {
      skip: ':skip',
      max: 'upper %d chars',
      min: '%d chars at least',
      emptyWarning: 'can not be empty',
      upperLimitWarning: 'over limit',
      lowerLimitWarning: 'below limit'
    },
    questions: {
      type: {
        description: '选择一种提交类型:',
        enum: {
          feat: {
            description: '新功能',
            title: 'Features',
            emoji: '✨'
          },
          fix: {
            description: '修bug',
            title: 'Bug Fixes',
            emoji: '🐛'
          },
          docs: {
            description: '文档注释',
            title: 'Documentation',
            emoji: '📚'
          },
          style: {
            description: '代码格式(不影响代码运行)',
            title: 'Styles',
            emoji: '💎'
          },
          refactor: {
            description: '重构',
            title: 'Code Refactoring',
            emoji: '📦'
          },
          perf: {
            description: '调优',
            title: 'Performance Improvements',
            emoji: '🚀'
          },
          test: {
            description: '增加测试',
            title: 'Tests',
            emoji: '🚨'
          },
          merge: {
            description: '合并分支',
            title: 'Merge',
            emoji: '🗑'
          },
          rebase: {
            description: '合并修正',
            title: 'Rebase',
            emoji: '🗑'
          },
          revert: {
            description: '分支修正',
            title: 'Reverts',
            emoji: '🗑'
          },
          build: {
            description: '打包相关',
            title: 'Builds',
            emoji: '🛠'
          },
          ci: {
            description: '持续集成脚本相关',
            title: 'Continuous Integrations',
            emoji: '⚙️'
          },
          chore: {
            description: '其他',
            title: 'Chores',
            emoji: '♻️'
          }
        }
      }
    }
  }
};