iter(f04): commit-lint 收严强制 scope
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- 应用:`demo` / `docs`
|
||||
- 元数据:`backlog` / `repo` / `protocol`
|
||||
- `iter` 提交的 scope 固定为条目 id:`b02`、`c01`、`d29` …
|
||||
- **scope 强制**:除 Merge/Revert 自动信息外,所有 type 必须带 scope;`ua commit-lint` 已机器校验,裸 type(`chore:` / `docs:`)一律拒绝
|
||||
|
||||
## subject 规则
|
||||
|
||||
|
||||
@@ -680,7 +680,8 @@ function cmdCommitLint(args) {
|
||||
if (!TYPES.includes(type)) problems.push(`type「${type}」不在枚举:${TYPES.join('/')}`);
|
||||
// iter 提交 scope 必须是 backlog 条目 id
|
||||
if (type === 'iter' && !/^[a-z]\d{2,}$/.test(scope ?? '')) problems.push('iter 提交的 scope 必须是 backlog 条目 id(如 b02/e03)');
|
||||
// 非 iter 提交 scope 仅允许小写字母与连字符
|
||||
// 非 iter 提交 scope 必填(杜绝 chore:/docs: 裸 type 放行),且仅允许小写字母与连字符
|
||||
if (type !== 'iter' && !scope) problems.push(`type「${type}」必须带 scope,如 chore(backlog):`);
|
||||
if (type !== 'iter' && scope && !/^[a-z][a-z-]*$/.test(scope)) problems.push(`scope「${scope}」仅允许小写字母与连字符`);
|
||||
// subject 长度与标点
|
||||
if ([...subject].length > 50) problems.push(`subject 超过 50 字符(当前 ${[...subject].length})`);
|
||||
|
||||
Reference in New Issue
Block a user