chore: enable no-sync-fn-in-async-fn lint rule (#4471)

* chore: enable `no-sync-fn-in-async-fn` lint rule

* revert for serveTls test
This commit is contained in:
Gabriele Belluardo 2024-03-12 01:36:10 +01:00 committed by GitHub
parent d63e97c735
commit 4da7440c62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View File

@ -40,7 +40,8 @@
"lint": {
"rules": {
"include": [
"camelcase"
"camelcase",
"no-sync-fn-in-async-fn"
]
}
}

View File

@ -137,7 +137,7 @@ Deno.test("ensureLink() rejects if link does not exist", async function () {
// "Access is denied. (os error 5)" // throw in CI
);
Deno.removeSync(testDir, { recursive: true });
await Deno.remove(testDir, { recursive: true });
});
Deno.test("ensureLinkSync() throws if link does not exist", function () {

View File

@ -958,13 +958,15 @@ Deno.test(
},
},
async () => {
const tempDir = Deno.makeTempDirSync({ dir: `${moduleDir}/testdata` });
const tempDir = await Deno.makeTempDir({
dir: `${moduleDir}/testdata`,
});
const req = new Request(`http://localhost/${basename(tempDir)}/`);
const res = await serveDir(req, serveDirOptions);
await res.body?.cancel();
assertEquals(res.status, 200);
Deno.removeSync(tempDir);
await Deno.remove(tempDir);
},
);

View File

@ -773,7 +773,9 @@ export async function serveTls(
once: true,
});
// deno-lint-ignore no-sync-fn-in-async-fn
const key = options.key || Deno.readTextFileSync(options.keyFile!);
// deno-lint-ignore no-sync-fn-in-async-fn
const cert = options.cert || Deno.readTextFileSync(options.certFile!);
const listener = Deno.listenTls({