mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
chore: fix lint:docs
task concurrency (#5756)
This commit is contained in:
parent
ba1bc9164a
commit
b0708f49aa
@ -22,6 +22,7 @@ import {
|
||||
type Location,
|
||||
type TsTypeDef,
|
||||
} from "@deno/doc";
|
||||
import { pooledMap } from "@std/async/pool";
|
||||
|
||||
type DocNodeWithJsDoc<T = DocNodeBase> = T & {
|
||||
jsDoc: JsDoc;
|
||||
@ -83,7 +84,7 @@ const ASSERTION_IMPORT =
|
||||
/from "@std\/(assert(\/[a-z-]+)?|testing\/(mock|snapshot|types))"/g;
|
||||
const NEWLINE = "\n";
|
||||
const diagnostics: DocumentError[] = [];
|
||||
const snippetPromises: Promise<void>[] = [];
|
||||
const snippetPromises: (() => Promise<void>)[] = [];
|
||||
|
||||
class DocumentError extends Error {
|
||||
constructor(
|
||||
@ -246,11 +247,12 @@ function assertSnippetsWork(
|
||||
);
|
||||
}
|
||||
snippetPromises.push(
|
||||
assertSnippetEvals({
|
||||
snippet,
|
||||
document,
|
||||
expectError: delim?.includes("expect-error") ?? false,
|
||||
}),
|
||||
() =>
|
||||
assertSnippetEvals({
|
||||
snippet,
|
||||
document,
|
||||
expectError: delim?.includes("expect-error") ?? false,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -528,13 +530,16 @@ if (!lintStatus.success) {
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
||||
const promises = [];
|
||||
for (const url of ENTRY_POINT_URLS) {
|
||||
promises.push(checkDocs(url));
|
||||
}
|
||||
await Promise.all(ENTRY_POINT_URLS.map(checkDocs));
|
||||
|
||||
await Promise.all(promises);
|
||||
await Promise.all(snippetPromises);
|
||||
const iter = pooledMap(
|
||||
navigator.hardwareConcurrency,
|
||||
snippetPromises,
|
||||
(fn) => fn(),
|
||||
);
|
||||
for await (const _ of iter) {
|
||||
// noop
|
||||
}
|
||||
if (diagnostics.length > 0) {
|
||||
for (const error of diagnostics) {
|
||||
console.error(
|
||||
|
Loading…
Reference in New Issue
Block a user