Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli/tests): remove unecessary void return types #11577

Merged
merged 2 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/tests/004_set_timeout.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
setTimeout((): void => {
setTimeout(() => {
console.log("World");
}, 10);

console.log("Hello");

const id = setTimeout((): void => {
const id = setTimeout(() => {
console.log("Not printed");
}, 10000);

Expand Down
4 changes: 2 additions & 2 deletions cli/tests/012_async.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Check that we can use the async keyword.
async function main(): Promise<void> {
await new Promise((resolve): void => {
async function main() {
await new Promise((resolve) => {
console.log("2");
setTimeout(resolve, 100);
});
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/013_dynamic_import.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(async (): Promise<void> => {
(async () => {
const { returnsHi, returnsFoo2, printHello3 } = await import(
"./subdir/mod1.ts"
);
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/014_duplicate_import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import "./subdir/auto_print_hello.ts";

import "./subdir/auto_print_hello.ts";

(async (): Promise<void> => {
(async () => {
await import("./subdir/auto_print_hello.ts");
})();
2 changes: 1 addition & 1 deletion cli/tests/016_double_await.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This is to test if Deno would die at 2nd await
// See https://github.com/denoland/deno/issues/919
(async (): Promise<void> => {
(async () => {
const currDirInfo = await Deno.stat(".");
const parentDirInfo = await Deno.stat("..");
console.log(currDirInfo.isDirectory);
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/018_async_catch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function fn(): Promise<never> {
throw new Error("message");
}
async function call(): Promise<void> {
async function call() {
try {
console.log("before await fn()");
await fn();
Expand All @@ -11,4 +11,4 @@ async function call(): Promise<void> {
}
console.log("after try-catch");
}
call().catch((): void => console.log("outer catch"));
call().catch(() => console.log("outer catch"));
2 changes: 1 addition & 1 deletion cli/tests/025_hrtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.onload = async (): Promise<void> => {
window.onload = async () => {
console.log(performance.now() % 2 !== 0);
await Deno.permissions.revoke({ name: "hrtime" });
console.log(performance.now() % 2 === 0);
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/028_args.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Deno.args.forEach((arg): void => {
Deno.args.forEach((arg) => {
console.log(arg);
});
2 changes: 1 addition & 1 deletion cli/tests/034_onload/imported.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assert } from "../../../test_util/std/testing/asserts.ts";
import "./nest_imported.ts";

const handler = (e: Event): void => {
const handler = (e: Event) => {
assert(!e.cancelable);
console.log(`got ${e.type} event in event handler (imported)`);
};
Expand Down
6 changes: 3 additions & 3 deletions cli/tests/034_onload/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "./imported.ts";
assert(window.hasOwnProperty("onload"));
assert(window.onload === null);

const eventHandler = (e: Event): void => {
const eventHandler = (e: Event) => {
assert(!e.cancelable);
console.log(`got ${e.type} event in event handler (main)`);
};
Expand All @@ -13,12 +13,12 @@ window.addEventListener("load", eventHandler);

window.addEventListener("unload", eventHandler);

window.onload = (e: Event): void => {
window.onload = (e: Event) => {
assert(!e.cancelable);
console.log(`got ${e.type} event in onload function`);
};

window.onunload = (e: Event): void => {
window.onunload = (e: Event) => {
assert(!e.cancelable);
console.log(`got ${e.type} event in onunload function`);
};
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/034_onload/nest_imported.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert } from "../../../test_util/std/testing/asserts.ts";

const handler = (e: Event): void => {
const handler = (e: Event) => {
assert(!e.cancelable);
console.log(`got ${e.type} event in event handler (nest_imported)`);
};
Expand Down
14 changes: 7 additions & 7 deletions cli/tests/045_proxy_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assertEquals } from "../../test_util/std/testing/asserts.ts";

const addr = Deno.args[1] || "127.0.0.1:4555";

async function proxyServer(): Promise<void> {
async function proxyServer() {
const server = serve(addr);

console.log(`Proxy server listening on https://${addr}/`);
Expand All @@ -13,7 +13,7 @@ async function proxyServer(): Promise<void> {
}
}

async function proxyRequest(req: ServerRequest): Promise<void> {
async function proxyRequest(req: ServerRequest) {
console.log(`Proxy request to: ${req.url}`);
const proxyAuthorization = req.headers.get("proxy-authorization");
if (proxyAuthorization) {
Expand All @@ -31,7 +31,7 @@ async function proxyRequest(req: ServerRequest): Promise<void> {
});
}

async function testFetch(): Promise<void> {
async function testFetch() {
const c = Deno.run({
cmd: [
Deno.execPath(),
Expand All @@ -52,7 +52,7 @@ async function testFetch(): Promise<void> {
c.close();
}

async function testModuleDownload(): Promise<void> {
async function testModuleDownload() {
const http = Deno.run({
cmd: [
Deno.execPath(),
Expand All @@ -72,7 +72,7 @@ async function testModuleDownload(): Promise<void> {
http.close();
}

async function testFetchNoProxy(): Promise<void> {
async function testFetchNoProxy() {
const c = Deno.run({
cmd: [
Deno.execPath(),
Expand All @@ -94,7 +94,7 @@ async function testFetchNoProxy(): Promise<void> {
c.close();
}

async function testModuleDownloadNoProxy(): Promise<void> {
async function testModuleDownloadNoProxy() {
const http = Deno.run({
cmd: [
Deno.execPath(),
Expand All @@ -115,7 +115,7 @@ async function testModuleDownloadNoProxy(): Promise<void> {
http.close();
}

async function testFetchProgrammaticProxy(): Promise<void> {
async function testFetchProgrammaticProxy() {
const c = Deno.run({
cmd: [
Deno.execPath(),
Expand Down
8 changes: 4 additions & 4 deletions cli/tests/055_info_file_json.out
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
"code": "file:https://[WILDCARD]/cli/tests/subdir/subdir2/mod2.ts"
}
],
"size": 320,
"size": 308,
"mediaType": "TypeScript",
"local": "[WILDCARD]mod1.ts",
[WILDCARD]
},
{
"specifier": "file:https://[WILDCARD]/cli/tests/subdir/print_hello.ts",
"dependencies": [],
"size": 63,
"size": 57,
"mediaType": "TypeScript",
"local": "[WILDCARD]print_hello.ts",
[WILDCARD]
Expand All @@ -43,11 +43,11 @@
"code": "file:https://[WILDCARD]/cli/tests/subdir/print_hello.ts"
}
],
"size": 163,
"size": 157,
"mediaType": "TypeScript",
"local": "[WILDCARD]mod2.ts",
[WILDCARD]
}
],
"size": 757
"size": 733
}
18 changes: 9 additions & 9 deletions cli/tests/076_info_json_deps_order.out
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"code": "file:https://[WILDCARD]/cli/tests/recursive_imports/common.ts"
}
],
"size": 114,
"size": 108,
"mediaType": "TypeScript",
"local": "[WILDCARD]A.ts",
"checksum": "da204c16d3114763810864083af8891a887d65fbe34e4c8b5bf985dbc8f0b01f"
"checksum": "3b45a105d892584298490cb73372b2cac57118e1e42a677a1d5cacea704d8d3a"
},
{
"specifier": "file:https://[WILDCARD]/cli/tests/recursive_imports/B.ts",
Expand All @@ -43,10 +43,10 @@
"code": "file:https://[WILDCARD]/cli/tests/recursive_imports/common.ts"
}
],
"size": 114,
"size": 108,
"mediaType": "TypeScript",
"local": "[WILDCARD]B.ts",
"checksum": "060ef62435d7e3a3276e8894307b19cf17772210a20dd091d24a670fadec6b83"
"checksum": "b12b0437ef9a91c4a4b1f66e8e4339f986b60bd8134031ccb296ce49df15b54e"
},
{
"specifier": "file:https://[WILDCARD]/cli/tests/recursive_imports/C.ts",
Expand All @@ -60,19 +60,19 @@
"code": "file:https://[WILDCARD]/cli/tests/recursive_imports/common.ts"
}
],
"size": 132,
"size": 126,
"mediaType": "TypeScript",
"local": "[WILDCARD]C.ts",
"checksum": "5190563583617a69f190f1cc76e6552df878df278cfaa5d5e30ebe0938cf5e0b"
"checksum": "605875a410741bfaeeade28cbccf45f219ad99d987ea695e35eda75d2c53a658"
},
{
"specifier": "file:https://[WILDCARD]/cli/tests/recursive_imports/common.ts",
"dependencies": [],
"size": 34,
"size": 28,
"mediaType": "TypeScript",
"local": "[WILDCARD]common.ts",
"checksum": "01b595d69514bfd001ba2cf421feabeaef559513f10697bf1a22781f8a8ed7f0"
"checksum": "c70025f0b936c02980c3be1fbd78f6f36b6241927c44ea67580821a6e664d8b3"
}
],
"size": 475
"size": 451
}
2 changes: 1 addition & 1 deletion cli/tests/bundle/file_tests-fixture11.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { a as defaultA, O } from "./subdir/m.ts";
export { O } from "./subdir/m.ts";

interface AOptions {
a?(): void;
a?();
c?: O;
}

Expand Down
4 changes: 2 additions & 2 deletions cli/tests/bundle_im.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export function returnsFoo2(): string {
return returnsFoo();
}

export function printHello3(): void {
export function printHello3() {
printHello2();
}

export function throwsError(): void {
export function throwsError() {
throw Error("exception from mod1");
}
2 changes: 1 addition & 1 deletion cli/tests/cat.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { copy } from "../../test_util/std/io/util.ts";
async function main(): Promise<void> {
async function main() {
for (let i = 1; i < Deno.args.length; i++) {
const filename = Deno.args[i];
const file = await Deno.open(filename);
Expand Down
10 changes: 5 additions & 5 deletions cli/tests/complex_permissions_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
const name = Deno.args[0];
// deno-lint-ignore no-explicit-any
const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
read(files: string[]): void {
read(files: string[]) {
files.forEach((file) => Deno.readFileSync(file));
},
write(files: string[]): void {
write(files: string[]) {
files.forEach((file) =>
Deno.writeFileSync(file, new Uint8Array(0), { append: true })
);
},
netFetch(urls: string[]): void {
netFetch(urls: string[]) {
urls.forEach((url) => fetch(url));
},
netListen(endpoints: string[]): void {
netListen(endpoints: string[]) {
endpoints.forEach((endpoint) => {
const index = endpoint.lastIndexOf(":");
const [hostname, port] = [
Expand All @@ -28,7 +28,7 @@ const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
listener.close();
});
},
async netConnect(endpoints: string[]): Promise<void> {
async netConnect(endpoints: string[]) {
for (const endpoint of endpoints) {
const index = endpoint.lastIndexOf(":");
const [hostname, port] = [
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/echo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function echo(args: string[]): void {
function echo(args: string[]) {
const msg = args.join(", ");
Deno.stdout.write(new TextEncoder().encode(msg));
}
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/echo_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const [hostname, port] = addr.split(":");
const listener = Deno.listen({ hostname, port: Number(port) });
console.log("listening on", addr);
listener.accept().then(
async (conn): Promise<void> => {
async (conn) => {
console.log("received bytes:", await copy(conn, conn));
conn.close();
listener.close();
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/error_001.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function foo(): never {
throw Error("bad");
}

function bar(): void {
function bar() {
foo();
}

Expand Down
2 changes: 1 addition & 1 deletion cli/tests/error_002.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { throwsError } from "./subdir/mod1.ts";

function foo(): void {
function foo() {
throwsError();
}

Expand Down
2 changes: 1 addition & 1 deletion cli/tests/error_005_missing_dynamic_import.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(async (): Promise<void> => {
(async () => {
const _badModule = await import("./bad-module.ts");
})();
2 changes: 1 addition & 1 deletion cli/tests/error_012_bad_dynamic_import_specifier.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(async (): Promise<void> => {
(async () => {
const _badModule = await import("bad-module.ts");
})();
2 changes: 1 addition & 1 deletion cli/tests/error_023_stack_async.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const p = (async (): Promise<void> => {
const p = (async () => {
await Promise.resolve().then((): never => {
throw new Error("async");
});
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/info_recursive_imports_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { A } from "./recursive_imports/A.ts";

export function test(): void {
export function test() {
A();
}
2 changes: 1 addition & 1 deletion cli/tests/js_import_detect.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function define(_foo: string[]): void {}
function define(_foo: string[]) {}
define(["long"]);
console.log("ok");
2 changes: 1 addition & 1 deletion cli/tests/lock_check_err.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"https://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fe7bbccaedb6579200a8b582f905139296402d06b1b91109d6e12c41a23125da",
"https://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"https://127.0.0.1:4545/cli/tests/003_relative_import.ts": "bad"
}
4 changes: 2 additions & 2 deletions cli/tests/lock_check_err_with_bundle.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"https://127.0.0.1:4545/cli/tests/subdir/mod1.ts": "bc699ebc05dec9a4baf2109258f03e6ec8dd5498e2f8c5469b62073b3b241657",
"https://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fe7bbccaedb6579200a8b582f905139296402d06b1b91109d6e12c41a23125da",
"https://127.0.0.1:4545/cli/tests/subdir/mod1.ts": "bfc1037b02c99abc20367f739bca7455813a5950066abd77965bff33b6eece0f",
"https://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"https://127.0.0.1:4545/cli/tests/subdir/subdir2/mod2.ts": "bad"
}
2 changes: 1 addition & 1 deletion cli/tests/lock_check_ok.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"https://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fe7bbccaedb6579200a8b582f905139296402d06b1b91109d6e12c41a23125da",
"https://127.0.0.1:4545/cli/tests/subdir/print_hello.ts": "fa6692c8f9ff3fb107e773c3ece5274e9d08be282867a1e3ded1d9c00fcaa63c",
"https://127.0.0.1:4545/cli/tests/003_relative_import.ts": "aa9e16de824f81871a1c7164d5bd6857df7db2e18621750bd66b0bde4df07f21"
}
Loading