deno.land / std@0.224.0 / _tools / check_deprecation.ts

check_deprecation.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license./** * Checks whether all deprecated tags have a message. * * @example * ```sh * deno task lint:deprecations * ``` */
import { doc } from "deno_doc/mod.ts";import { walk } from "../fs/walk.ts";import { toFileUrl } from "../path/to_file_url.ts";
const ROOT = new URL("../", import.meta.url);
let failed = false;
const iter = walk(ROOT, { includeDirs: false, exts: [".ts"], skip: [ /.git/, /(\/|\\)_/, /_test.ts$/, ],});
for await (const entry of iter) { const url = toFileUrl(entry.path); const docs = await doc(url.href); for (const document of docs) { const tags = document.jsDoc?.tags; if (!tags) continue; for (const tag of tags) { if (tag.kind !== "deprecated") continue; if (tag.doc === undefined) { console.log( `%c@deprecated tag with JSDoc block must have a message: ${document.location.filename}:${document.location.line}`, "color: yellow", ); failed = true; } } }}
if (failed) Deno.exit(1);
std

Version Info

Tagged at
6 months ago