[TBID:ECX-9138] feat(commitlint): add TBID header rule and update config for commit message validation

This commit is contained in:
lukaijie
2026-07-03 13:55:19 +08:00
parent b297512184
commit af925aa2ae
2 changed files with 59 additions and 27 deletions

14
commitlint-tbid-plugin.js Normal file
View File

@@ -0,0 +1,14 @@
module.exports = {
rules: {
'tbid-header': (parsed, when = 'always') => {
const matches =
typeof parsed.header === 'string' && /^\[TBID:[A-Za-z0-9]+-\d+\]\s.+/.test(parsed.header)
const negated = when === 'never'
return [
negated ? !matches : matches,
'commit message must start with [TBID:PROJECT-123] description'
]
}
}
}