chore: 增加提交信息中文校验
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
if [ ! -w "${HOME:-/root}" ]; then
|
if [ ! -w "${HOME:-/root}" ]; then
|
||||||
|
export HOME=/tmp
|
||||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-/tmp}"
|
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-/tmp}"
|
||||||
export COREPACK_HOME="${COREPACK_HOME:-/tmp/corepack}"
|
export COREPACK_HOME="${COREPACK_HOME:-/tmp/corepack}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
if [ ! -w "${HOME:-/root}" ]; then
|
if [ ! -w "${HOME:-/root}" ]; then
|
||||||
|
export HOME=/tmp
|
||||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-/tmp}"
|
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-/tmp}"
|
||||||
export COREPACK_HOME="${COREPACK_HOME:-/tmp/corepack}"
|
export COREPACK_HOME="${COREPACK_HOME:-/tmp/corepack}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -8,6 +8,23 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
// 继承的规则
|
// 继承的规则
|
||||||
extends: ['@commitlint/config-conventional'],
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
// 自定义插件规则
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'subject-chinese': (parsed) => {
|
||||||
|
const subject = String(parsed?.subject ?? '').trim()
|
||||||
|
if (!subject) {
|
||||||
|
return [false, '冒号后面的内容(subject)不能为空']
|
||||||
|
}
|
||||||
|
|
||||||
|
// 要求 subject 以中文字符开头(允许后续包含数字/空格/标点/英文缩写)
|
||||||
|
const startsWithChinese = /^[\u4E00-\u9FFF]/u.test(subject)
|
||||||
|
return [startsWithChinese, '冒号后面的内容(subject)必须以中文开头']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
// 自定义规则
|
// 自定义规则
|
||||||
rules: {
|
rules: {
|
||||||
// 提交类型枚举,git提交type必须是以下类型
|
// 提交类型枚举,git提交type必须是以下类型
|
||||||
@@ -29,6 +46,7 @@ module.exports = {
|
|||||||
'wip' // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
|
'wip' // 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'subject-chinese': [2, 'always'],
|
||||||
'subject-case': [0] // subject大小写不做校验
|
'subject-case': [0] // subject大小写不做校验
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user