Turn on promise-function-async and init-declarations and satisfy them with async functions and null-initialized lets

This commit is contained in:
Danny Kim
2026-10-19 19:44:35 +09:00
parent a65bf353ab
commit d879b04e46
14 changed files with 147 additions and 99 deletions
+17 -3
View File
@@ -40,7 +40,11 @@ const findStep = (steps: Mapping[], key: string, value: string): Mapping => {
test("all committed YAML parses", async () => {
const files = await yamlFiles();
assert(files.length > 0);
await Promise.all(files.map((file) => yaml(file)));
await Promise.all(
files.map(async (file) => {
await yaml(file);
}),
);
});
test("the action exposes only the master key and scopes it to preparation", async () => {
@@ -94,7 +98,12 @@ test("the source protection script stages immutable action files", async () => {
"profiles.json",
"prompt.md",
];
const stats = await Promise.all(files.map((file) => stat(`${path}/${file}`)));
const stats = await Promise.all(
files.map(async (file) => {
const info = await stat(`${path}/${file}`);
return info;
}),
);
for (const [index, info] of stats.entries()) {
assert(info.isFile(), files[index]);
expect(info.mode & 0o022, files[index]).toStrictEqual(0);
@@ -110,7 +119,12 @@ test("module-relative runtime assets exist", async () => {
const assets = [...source.matchAll(/new URL\("(?<asset>[^"]+)", import\.meta\.url\)/gu)].map(
([, asset = ""]) => new URL(asset, module),
);
const stats = await Promise.all(assets.map((asset) => stat(asset)));
const stats = await Promise.all(
assets.map(async (asset) => {
const info = await stat(asset);
return info;
}),
);
for (const [index, info] of stats.entries()) {
assert(info.isFile(), assets[index]?.pathname);
}