From 1c454c444d7eb133a3fc78e470b3a37bf3be7ccc Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 6 Sep 2024 14:32:01 +0200 Subject: [PATCH] make work with dnt --- command/_runtime/exit.ts | 2 +- command/_runtime/get-argv.ts | 2 +- command/_runtime/get-env.ts | 2 +- command/_runtime/no_color.ts | 7 ++++--- command/_runtime/write_sync.ts | 2 +- command/upgrade/get_runtime.ts | 2 +- internal/runtime/exit.ts | 2 +- internal/runtime/get_args.ts | 2 +- internal/runtime/get_env.ts | 2 +- internal/runtime/get_os.ts | 2 +- internal/runtime/is_terminal.ts | 2 +- internal/runtime/no_color.ts | 7 ++++--- internal/runtime/read.ts | 2 +- internal/runtime/set_raw.ts | 4 ++-- internal/runtime/write_sync.ts | 2 +- 15 files changed, 22 insertions(+), 20 deletions(-) diff --git a/command/_runtime/exit.ts b/command/_runtime/exit.ts index d6370104..66ce1cc0 100644 --- a/command/_runtime/exit.ts +++ b/command/_runtime/exit.ts @@ -1,5 +1,5 @@ export function exit(code: number): never { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; const exit: (code: number) => never = Deno?.exit ?? process?.exit; diff --git a/command/_runtime/get-argv.ts b/command/_runtime/get-argv.ts index e702d35d..d20de72a 100644 --- a/command/_runtime/get-argv.ts +++ b/command/_runtime/get-argv.ts @@ -1,5 +1,5 @@ export function getArgv(): Array { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; return Deno?.args ?? process?.argv.slice(2) ?? []; diff --git a/command/_runtime/get-env.ts b/command/_runtime/get-env.ts index 0f49b663..5912af6f 100644 --- a/command/_runtime/get-env.ts +++ b/command/_runtime/get-env.ts @@ -1,5 +1,5 @@ export function getEnv(name: string): string | undefined { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/command/_runtime/no_color.ts b/command/_runtime/no_color.ts index 51433280..8055511f 100644 --- a/command/_runtime/no_color.ts +++ b/command/_runtime/no_color.ts @@ -1,12 +1,13 @@ export function getNoColor(): boolean { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { return Deno.noColor; } else if (process) { - return process?.env.NO_COLOR === "1" || - process?.env.NODE_DISABLE_COLORS === "1"; + return ( + process?.env.NO_COLOR === "1" || process?.env.NODE_DISABLE_COLORS === "1" + ); } throw new Error("unsupported runtime"); diff --git a/command/_runtime/write_sync.ts b/command/_runtime/write_sync.ts index f46d6962..65d879a0 100644 --- a/command/_runtime/write_sync.ts +++ b/command/_runtime/write_sync.ts @@ -1,5 +1,5 @@ export function writeSync(data: Uint8Array): number { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/command/upgrade/get_runtime.ts b/command/upgrade/get_runtime.ts index ed33e7e1..36fdd8aa 100644 --- a/command/upgrade/get_runtime.ts +++ b/command/upgrade/get_runtime.ts @@ -11,7 +11,7 @@ export interface GetRuntimeResult { /** Get runtime handler for current runtime. */ export async function getRuntime(): Promise { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno?.version?.deno) { diff --git a/internal/runtime/exit.ts b/internal/runtime/exit.ts index ed5e8579..fb34258f 100644 --- a/internal/runtime/exit.ts +++ b/internal/runtime/exit.ts @@ -5,7 +5,7 @@ * @param code The exit code. */ export function exit(code: number): never { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; const exit: (code: number) => never = Deno?.exit ?? process?.exit; diff --git a/internal/runtime/get_args.ts b/internal/runtime/get_args.ts index 6f81d7ab..460df100 100644 --- a/internal/runtime/get_args.ts +++ b/internal/runtime/get_args.ts @@ -4,7 +4,7 @@ * @internal */ export function getArgs(): Array { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; return Deno?.args ?? process?.argv.slice(2) ?? []; diff --git a/internal/runtime/get_env.ts b/internal/runtime/get_env.ts index 03af34e1..53dbc3f4 100644 --- a/internal/runtime/get_env.ts +++ b/internal/runtime/get_env.ts @@ -5,7 +5,7 @@ * @param name The name of the environment variable. */ export function getEnv(name: string): string | undefined { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/get_os.ts b/internal/runtime/get_os.ts index d2481fbf..1d6676ee 100644 --- a/internal/runtime/get_os.ts +++ b/internal/runtime/get_os.ts @@ -16,7 +16,7 @@ export function getOs(): | "openbsd" | "sunos" | "win32" { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/is_terminal.ts b/internal/runtime/is_terminal.ts index db4981be..176e3eac 100644 --- a/internal/runtime/is_terminal.ts +++ b/internal/runtime/is_terminal.ts @@ -4,7 +4,7 @@ * @internal */ export function isTerminal(): boolean { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/no_color.ts b/internal/runtime/no_color.ts index bb860138..ca227550 100644 --- a/internal/runtime/no_color.ts +++ b/internal/runtime/no_color.ts @@ -4,14 +4,15 @@ * @internal */ export function getNoColor(): boolean { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { return Deno.noColor; } else if (process) { - return process?.env.NO_COLOR === "1" || - process?.env.NODE_DISABLE_COLORS === "1"; + return ( + process?.env.NO_COLOR === "1" || process?.env.NODE_DISABLE_COLORS === "1" + ); } throw new Error("unsupported runtime"); diff --git a/internal/runtime/read.ts b/internal/runtime/read.ts index 94510ed1..a6bb7277 100644 --- a/internal/runtime/read.ts +++ b/internal/runtime/read.ts @@ -5,7 +5,7 @@ * @param data Uint8Array to store the data. */ export function read(data: Uint8Array): Promise { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/set_raw.ts b/internal/runtime/set_raw.ts index ffd48ffb..dcd14b1a 100644 --- a/internal/runtime/set_raw.ts +++ b/internal/runtime/set_raw.ts @@ -7,9 +7,9 @@ */ export function setRaw( mode: boolean, - { cbreak }: { cbreak?: boolean } = {}, + { cbreak }: { cbreak?: boolean } = {} ): void { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/write_sync.ts b/internal/runtime/write_sync.ts index 1b5623cd..25e320a8 100644 --- a/internal/runtime/write_sync.ts +++ b/internal/runtime/write_sync.ts @@ -5,7 +5,7 @@ * @param data Data to write to stdout. */ export function writeSync(data: Uint8Array): number { - // deno-lint-ignore no-explicit-any + // dnt-shim-ignore deno-lint-ignore no-explicit-any const { Deno, process } = globalThis as any; if (Deno) {