commitlint config-conventional - 为提交消息添加前缀

Gau*_*hah 5 git github node.js github-actions

我正在尝试为我的一个存储库实现commitlint,以便所有提交消息都是标准的。但是,我们要求添加 JIRA ID 作为前缀的一部分。

目前,commitlint 格式如下

subject(scope): message 
Run Code Online (Sandbox Code Playgroud)

我需要如下所述

JIRA-ID: subject(scope): message 
Run Code Online (Sandbox Code Playgroud)

以下作品

parserPreset: {
    parserOpts: {
         issuePrefixes: ['w{2,4}-[0.9]{2,4}']
    }
}
Run Code Online (Sandbox Code Playgroud)

但是它验证 JIRA id 应该位于末尾。像下面的东西

subject(scope): message JIRA-ID
Run Code Online (Sandbox Code Playgroud)

小智 2

您可以使用这个包https://github.com/Gherciu/commitlint-jira它开箱即用,具有 Jira 提交风格;)

有关提示和高级用法,您可以阅读此博客文章