包文件→ .shtukbase/packages/std-keep-a-changelog/checks/cl04_links.ts
checks/cl04_links.ts
13 行, 662 B.
文件按包中的原样显示:代码及其注释不做翻译。
- // CL-R04: every release heading has a link reference (`[1.2.0]: https://…compare/v1.1.0...v1.2.0`), Unreleased too.
- import { config, logs, PKG } from './kaclib.ts';
- import { finish, norm } from './lib/std.ts';
- const n = norm(PKG, 'CL-R04', 'observe');
- const out: string[] = [];
- if (n.active)
- for (const l of logs(config()).logs)
- for (const r of l.releases) {
- const key = r.unreleased ? 'unreleased' : (r.version ?? '').toLowerCase();
- if (!l.links.has(key)) out.push(`${l.file}:${r.line}: "${r.unreleased ? 'Unreleased' : r.version}" has no reference link "[${r.unreleased ? 'unreleased' : r.version}]: compare URL"`);
- }
- finish(n, out);