mirror of
https://github.com/denoland/deno.git
synced 2025-01-18 11:53:59 -05:00
refactor: add no-return-await lint rule (#4384)
This commit is contained in:
parent
70434b5bfb
commit
1edb20b399
18 changed files with 26 additions and 25 deletions
|
@ -21,7 +21,8 @@
|
||||||
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }
|
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }
|
||||||
],
|
],
|
||||||
"@typescript-eslint/ban-ts-ignore": ["off"],
|
"@typescript-eslint/ban-ts-ignore": ["off"],
|
||||||
"@typescript-eslint/no-empty-function": ["off"]
|
"@typescript-eslint/no-empty-function": ["off"],
|
||||||
|
"no-return-await": "error"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,5 +24,5 @@ export async function fetch(
|
||||||
zeroCopy = new Uint8Array(body.buffer, body.byteOffset, body.byteLength);
|
zeroCopy = new Uint8Array(body.buffer, body.byteOffset, body.byteLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
return await sendAsync("op_fetch", args, zeroCopy);
|
return sendAsync("op_fetch", args, zeroCopy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ export function makeTempDirSync(options: MakeTempOptions = {}): string {
|
||||||
export async function makeTempDir(
|
export async function makeTempDir(
|
||||||
options: MakeTempOptions = {}
|
options: MakeTempOptions = {}
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return await sendAsync("op_make_temp_dir", options);
|
return sendAsync("op_make_temp_dir", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function makeTempFileSync(options: MakeTempOptions = {}): string {
|
export function makeTempFileSync(options: MakeTempOptions = {}): string {
|
||||||
|
@ -24,5 +24,5 @@ export function makeTempFileSync(options: MakeTempOptions = {}): string {
|
||||||
export async function makeTempFile(
|
export async function makeTempFile(
|
||||||
options: MakeTempOptions = {}
|
options: MakeTempOptions = {}
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
return await sendAsync("op_make_temp_file", options);
|
return sendAsync("op_make_temp_file", options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export async function open(
|
||||||
mode: OpenMode | undefined,
|
mode: OpenMode | undefined,
|
||||||
options: OpenOptions | undefined
|
options: OpenOptions | undefined
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
return await sendAsync("op_open", {
|
return sendAsync("op_open", {
|
||||||
path,
|
path,
|
||||||
options,
|
options,
|
||||||
mode
|
mode
|
||||||
|
|
|
@ -6,5 +6,5 @@ export function readlinkSync(path: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function readlink(path: string): Promise<string> {
|
export async function readlink(path: string): Promise<string> {
|
||||||
return await sendAsync("op_read_link", { path });
|
return sendAsync("op_read_link", { path });
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,5 +6,5 @@ export function realpathSync(path: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function realpath(path: string): Promise<string> {
|
export async function realpath(path: string): Promise<string> {
|
||||||
return await sendAsync("op_realpath", { path });
|
return sendAsync("op_realpath", { path });
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ export async function seek(
|
||||||
offset: number,
|
offset: number,
|
||||||
whence: SeekMode
|
whence: SeekMode
|
||||||
): Promise<number> {
|
): Promise<number> {
|
||||||
return await sendAsync("op_seek", { rid, offset, whence });
|
return sendAsync("op_seek", { rid, offset, whence });
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class FsEvents implements AsyncIterableIterator<FsEvent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async next(): Promise<IteratorResult<FsEvent>> {
|
async next(): Promise<IteratorResult<FsEvent>> {
|
||||||
return await sendAsync("op_fs_events_poll", {
|
return sendAsync("op_fs_events_poll", {
|
||||||
rid: this.rid
|
rid: this.rid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ interface AcceptResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function accept(rid: number): Promise<AcceptResponse> {
|
export async function accept(rid: number): Promise<AcceptResponse> {
|
||||||
return await sendAsync("op_accept", { rid });
|
return sendAsync("op_accept", { rid });
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListenRequest {
|
export interface ListenRequest {
|
||||||
|
@ -75,7 +75,7 @@ export interface ConnectRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function connect(args: ConnectRequest): Promise<ConnectResponse> {
|
export async function connect(args: ConnectRequest): Promise<ConnectResponse> {
|
||||||
return await sendAsync("op_connect", args);
|
return sendAsync("op_connect", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ReceiveResponse {
|
interface ReceiveResponse {
|
||||||
|
@ -91,7 +91,7 @@ export async function receive(
|
||||||
rid: number,
|
rid: number,
|
||||||
zeroCopy: Uint8Array
|
zeroCopy: Uint8Array
|
||||||
): Promise<ReceiveResponse> {
|
): Promise<ReceiveResponse> {
|
||||||
return await sendAsync("op_receive", { rid }, zeroCopy);
|
return sendAsync("op_receive", { rid }, zeroCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SendRequest {
|
export interface SendRequest {
|
||||||
|
|
|
@ -13,7 +13,7 @@ interface RunStatusResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runStatus(rid: number): Promise<RunStatusResponse> {
|
export async function runStatus(rid: number): Promise<RunStatusResponse> {
|
||||||
return await sendAsync("op_run_status", { rid });
|
return sendAsync("op_run_status", { rid });
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RunRequest {
|
interface RunRequest {
|
||||||
|
|
|
@ -6,7 +6,7 @@ export function bindSignal(signo: number): { rid: number } {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function pollSignal(rid: number): Promise<{ done: boolean }> {
|
export async function pollSignal(rid: number): Promise<{ done: boolean }> {
|
||||||
return await sendAsync("op_signal_poll", { rid });
|
return sendAsync("op_signal_poll", { rid });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unbindSignal(rid: number): void {
|
export function unbindSignal(rid: number): void {
|
||||||
|
|
|
@ -26,7 +26,7 @@ interface ConnectTLSResponse {
|
||||||
export async function connectTLS(
|
export async function connectTLS(
|
||||||
args: ConnectTLSRequest
|
args: ConnectTLSRequest
|
||||||
): Promise<ConnectTLSResponse> {
|
): Promise<ConnectTLSResponse> {
|
||||||
return await sendAsync("op_connect_tls", args);
|
return sendAsync("op_connect_tls", args);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AcceptTLSResponse {
|
interface AcceptTLSResponse {
|
||||||
|
@ -44,7 +44,7 @@ interface AcceptTLSResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function acceptTLS(rid: number): Promise<AcceptTLSResponse> {
|
export async function acceptTLS(rid: number): Promise<AcceptTLSResponse> {
|
||||||
return await sendAsync("op_accept_tls", { rid });
|
return sendAsync("op_accept_tls", { rid });
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListenTLSRequest {
|
export interface ListenTLSRequest {
|
||||||
|
|
|
@ -25,5 +25,5 @@ export function hostPostMessage(id: number, data: Uint8Array): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function hostGetMessage(id: number): Promise<any> {
|
export async function hostGetMessage(id: number): Promise<any> {
|
||||||
return await sendAsync("op_host_get_message", { id });
|
return sendAsync("op_host_get_message", { id });
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ export class Process {
|
||||||
}
|
}
|
||||||
|
|
||||||
async status(): Promise<ProcessStatus> {
|
async status(): Promise<ProcessStatus> {
|
||||||
return await runStatus(this.rid);
|
return runStatus(this.rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async output(): Promise<Uint8Array> {
|
async output(): Promise<Uint8Array> {
|
||||||
|
|
|
@ -312,14 +312,14 @@ async function main(): Promise<void> {
|
||||||
|
|
||||||
// Master mode
|
// Master mode
|
||||||
if (args.master) {
|
if (args.master) {
|
||||||
return await masterRunnerMain(args.verbose, filter);
|
return masterRunnerMain(args.verbose, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Worker mode
|
// Worker mode
|
||||||
if (args.worker) {
|
if (args.worker) {
|
||||||
assertOrHelp(typeof args.addr === "string");
|
assertOrHelp(typeof args.addr === "string");
|
||||||
assertOrHelp(typeof args.perms === "string");
|
assertOrHelp(typeof args.perms === "string");
|
||||||
return await workerRunnerMain(args.addr, args.perms, filter);
|
return workerRunnerMain(args.addr, args.perms, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Running tests matching current process permissions
|
// Running tests matching current process permissions
|
||||||
|
|
|
@ -453,7 +453,7 @@ async function sendFetchReq(
|
||||||
headers: headerArray
|
headers: headerArray
|
||||||
};
|
};
|
||||||
|
|
||||||
return await opFetch(args, body);
|
return opFetch(args, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetch(
|
export async function fetch(
|
||||||
|
|
|
@ -85,7 +85,7 @@ function listen() {
|
||||||
|
|
||||||
/** Accepts a connection, returns rid. */
|
/** Accepts a connection, returns rid. */
|
||||||
async function accept(rid) {
|
async function accept(rid) {
|
||||||
return await sendAsync(ops["accept"], rid);
|
return sendAsync(ops["accept"], rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,12 +93,12 @@ async function accept(rid) {
|
||||||
* Returns bytes read.
|
* Returns bytes read.
|
||||||
*/
|
*/
|
||||||
async function read(rid, data) {
|
async function read(rid, data) {
|
||||||
return await sendAsync(ops["read"], rid, data);
|
return sendAsync(ops["read"], rid, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Writes a fixed HTTP response to the socket rid. Returns bytes written. */
|
/** Writes a fixed HTTP response to the socket rid. Returns bytes written. */
|
||||||
async function write(rid, data) {
|
async function write(rid, data) {
|
||||||
return await sendAsync(ops["write"], rid, data);
|
return sendAsync(ops["write"], rid, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(rid) {
|
function close(rid) {
|
||||||
|
|
|
@ -126,7 +126,7 @@ async function serveDir(
|
||||||
const fileUrl = posix.join(dirUrl, fileInfo.name ?? "");
|
const fileUrl = posix.join(dirUrl, fileInfo.name ?? "");
|
||||||
if (fileInfo.name === "index.html" && fileInfo.isFile()) {
|
if (fileInfo.name === "index.html" && fileInfo.isFile()) {
|
||||||
// in case index.html as dir...
|
// in case index.html as dir...
|
||||||
return await serveFile(req, filePath);
|
return serveFile(req, filePath);
|
||||||
}
|
}
|
||||||
// Yuck!
|
// Yuck!
|
||||||
let mode = null;
|
let mode = null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue