我们正在使用commitlint在我们的提交上执行命名约定,但是,我可以弄清楚如何允许它忽略包含“ WIP”的提交消息。
https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-configuration.md
/*
* Functions that return true if commitlint should ignore the given message.
*/
ignores?: ((message: string) => boolean)[];
这是我们当前的提交皮棉配置:
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [2, 'never', ['start-case', 'pascal-case']],
},
ignores: [],
};
添加此示例的语法是什么?
语法由ignores?: ((message: string) => boolean)[];
提供的类型信息给出。
您需要添加一个函数,该函数接受字符串参数message
,对其进行处理,然后返回布尔值。一个例子:
ignores: [
(message) => message.includes('WIP')
]
如果消息中的任何地方都有true
,则会添加一个返回WIP
的函数,从而使其被忽略。