diff options
author | Samrith Shankar <samrith-s@users.noreply.github.com> | 2020-03-20 14:38:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-20 09:38:34 -0400 |
commit | 798904b0f2ed0c7284b67bba2f125f406b5850de (patch) | |
tree | 5aba8d35aa8984aa778c894258bcaed56f1ce17c /cli/js/web/fetch.ts | |
parent | 35f6e2e45ddb96524a6bdf54b0a6155caa88d5e0 (diff) |
Add require-await lint rule (#4401)
Diffstat (limited to 'cli/js/web/fetch.ts')
-rw-r--r-- | cli/js/web/fetch.ts | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cli/js/web/fetch.ts b/cli/js/web/fetch.ts index 7ab68d2e4..62e5d7928 100644 --- a/cli/js/web/fetch.ts +++ b/cli/js/web/fetch.ts @@ -60,6 +60,7 @@ class Body implements domTypes.Body, domTypes.ReadableStream, io.ReadCloser { return this._data; } + // eslint-disable-next-line require-await async arrayBuffer(): Promise<ArrayBuffer> { // If we've already bufferred the response, just return it. if (this._data != null) { @@ -223,11 +224,12 @@ class Body implements domTypes.Body, domTypes.ReadableStream, io.ReadCloser { return read(this.rid, p); } - close(): void { + close(): Promise<void> { close(this.rid); + return Promise.resolve(); } - async cancel(): Promise<void> { + cancel(): Promise<void> { return notImplemented(); } @@ -346,7 +348,7 @@ export class Response implements domTypes.Response { return false; } - async arrayBuffer(): Promise<ArrayBuffer> { + arrayBuffer(): Promise<ArrayBuffer> { /* You have to do the null check here and not in the function because * otherwise TS complains about this.body potentially being null */ if (this.bodyViewable() || this.body == null) { @@ -355,14 +357,14 @@ export class Response implements domTypes.Response { return this.body.arrayBuffer(); } - async blob(): Promise<domTypes.Blob> { + blob(): Promise<domTypes.Blob> { if (this.bodyViewable() || this.body == null) { return Promise.reject(new Error("Response body is null")); } return this.body.blob(); } - async formData(): Promise<domTypes.FormData> { + formData(): Promise<domTypes.FormData> { if (this.bodyViewable() || this.body == null) { return Promise.reject(new Error("Response body is null")); } @@ -370,14 +372,14 @@ export class Response implements domTypes.Response { } // eslint-disable-next-line @typescript-eslint/no-explicit-any - async json(): Promise<any> { + json(): Promise<any> { if (this.bodyViewable() || this.body == null) { return Promise.reject(new Error("Response body is null")); } return this.body.json(); } - async text(): Promise<string> { + text(): Promise<string> { if (this.bodyViewable() || this.body == null) { return Promise.reject(new Error("Response body is null")); } @@ -437,7 +439,7 @@ export class Response implements domTypes.Response { } } -async function sendFetchReq( +function sendFetchReq( url: string, method: string | null, headers: domTypes.Headers | null, |