From 58ecdb85557041bff41e155fc3801589f7c00365 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 12 Nov 2024 14:22:44 +0100 Subject: [PATCH] fix lint --- command/command.ts | 1 + command/upgrade/get_runtime.ts | 4 +++- command/upgrade/runtime/bun_runtime.ts | 6 ++++-- command/upgrade/spinner.ts | 4 +++- internal/runtime/delete_env.ts | 4 +++- internal/runtime/exit.ts | 4 +++- internal/runtime/get_args.ts | 4 +++- internal/runtime/get_columns.ts | 4 +++- internal/runtime/get_env.ts | 4 +++- internal/runtime/get_os.ts | 4 +++- internal/runtime/inspect.ts | 4 +++- internal/runtime/is_terminal.ts | 4 +++- internal/runtime/no_color.ts | 4 +++- internal/runtime/read.ts | 4 +++- internal/runtime/read_dir.ts | 4 +++- internal/runtime/read_sync.ts | 4 +++- internal/runtime/set_env.ts | 4 +++- internal/runtime/set_raw.ts | 4 +++- internal/runtime/stat.ts | 4 +++- internal/runtime/write_sync.ts | 4 +++- prompt/_generic_suggestions.ts | 6 ++++-- 21 files changed, 63 insertions(+), 22 deletions(-) diff --git a/command/command.ts b/command/command.ts index cbdfc920..7823b373 100644 --- a/command/command.ts +++ b/command/command.ts @@ -2051,6 +2051,7 @@ export class Command< names: readonly string[], ): Promise<{ name: string; value: string } | undefined> { for (const name of names) { + // dnt-shim-ignore const status = await (globalThis as any).Deno?.permissions.query({ name: "env", variable: name, diff --git a/command/upgrade/get_runtime.ts b/command/upgrade/get_runtime.ts index 5fa1d250..c2af0fb5 100644 --- a/command/upgrade/get_runtime.ts +++ b/command/upgrade/get_runtime.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + import type { RuntimeName } from "@cliffy/internal/runtime/runtime-name"; import type { Runtime } from "./runtime.ts"; @@ -9,7 +11,7 @@ export interface GetRuntimeResult { /** Get runtime handler for current runtime. */ export async function getRuntime(): Promise { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno?.version?.deno) { diff --git a/command/upgrade/runtime/bun_runtime.ts b/command/upgrade/runtime/bun_runtime.ts index 66969b08..078d845a 100644 --- a/command/upgrade/runtime/bun_runtime.ts +++ b/command/upgrade/runtime/bun_runtime.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + import { dim } from "@std/fmt/colors"; import type { Logger } from "../logger.ts"; import { NodeRuntime } from "./node_runtime.ts"; @@ -8,9 +10,9 @@ export class BunRuntime extends NodeRuntime { isJsr: boolean, logger?: Logger, ): Promise { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const Bun = (globalThis as any).Bun; - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const process = (globalThis as any).process; cmdArgs = isJsr diff --git a/command/upgrade/spinner.ts b/command/upgrade/spinner.ts index 5f7a773d..dc95443b 100644 --- a/command/upgrade/spinner.ts +++ b/command/upgrade/spinner.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { getNoColor } from "@cliffy/internal/runtime/no-color"; @@ -197,7 +199,7 @@ export class Spinner { * ``` */ start() { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore if (this.#active || (globalThis as any).Deno?.stdout.writable.locked) { return; } diff --git a/internal/runtime/delete_env.ts b/internal/runtime/delete_env.ts index 7d1deb0f..f8fa24c5 100644 --- a/internal/runtime/delete_env.ts +++ b/internal/runtime/delete_env.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Delete environment variable. * @@ -5,7 +7,7 @@ * @param name The name of the environment variable. */ export function deleteEnv(name: string): string | undefined { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/exit.ts b/internal/runtime/exit.ts index fb34258f..21cf0794 100644 --- a/internal/runtime/exit.ts +++ b/internal/runtime/exit.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Exit the current process with optional exit code. * @@ -5,7 +7,7 @@ * @param code The exit code. */ export function exit(code: number): never { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore 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 460df100..7e25f3cf 100644 --- a/internal/runtime/get_args.ts +++ b/internal/runtime/get_args.ts @@ -1,10 +1,12 @@ +// deno-lint-ignore-file no-explicit-any + /** * Get script arguments. * * @internal */ export function getArgs(): Array { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; return Deno?.args ?? process?.argv.slice(2) ?? []; diff --git a/internal/runtime/get_columns.ts b/internal/runtime/get_columns.ts index 0dd48b4c..b8f6d474 100644 --- a/internal/runtime/get_columns.ts +++ b/internal/runtime/get_columns.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Returns the width of the console window. * @@ -5,7 +7,7 @@ */ export function getColumns(): number | null { try { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; // Catch error in none tty mode: Inappropriate ioctl for device (os error 25) diff --git a/internal/runtime/get_env.ts b/internal/runtime/get_env.ts index 53dbc3f4..1ec24dde 100644 --- a/internal/runtime/get_env.ts +++ b/internal/runtime/get_env.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Get environment variable. * @@ -5,7 +7,7 @@ * @param name The name of the environment variable. */ export function getEnv(name: string): string | undefined { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/get_os.ts b/internal/runtime/get_os.ts index 1d6676ee..686d52b4 100644 --- a/internal/runtime/get_os.ts +++ b/internal/runtime/get_os.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Get operating system name. * @@ -16,7 +18,7 @@ export function getOs(): | "openbsd" | "sunos" | "win32" { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/inspect.ts b/internal/runtime/inspect.ts index 8db8659a..b1404512 100644 --- a/internal/runtime/inspect.ts +++ b/internal/runtime/inspect.ts @@ -1,10 +1,12 @@ +// deno-lint-ignore-file no-explicit-any + /** * Inspect values. * * @internal */ export function inspect(value: unknown, colors: boolean): string { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno } = globalThis as any; return Deno?.inspect( diff --git a/internal/runtime/is_terminal.ts b/internal/runtime/is_terminal.ts index 176e3eac..c78df5c9 100644 --- a/internal/runtime/is_terminal.ts +++ b/internal/runtime/is_terminal.ts @@ -1,10 +1,12 @@ +// deno-lint-ignore-file no-explicit-any + /** * Checks if current process is a tty. * * @internal */ export function isTerminal(): boolean { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/no_color.ts b/internal/runtime/no_color.ts index 7f0fb2a7..4e31ca5f 100644 --- a/internal/runtime/no_color.ts +++ b/internal/runtime/no_color.ts @@ -1,10 +1,12 @@ +// deno-lint-ignore-file no-explicit-any + /** * Checks if colors are enabled. * * @internal */ export function getNoColor(): boolean { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/read.ts b/internal/runtime/read.ts index c4e61ef9..cf72ae51 100644 --- a/internal/runtime/read.ts +++ b/internal/runtime/read.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Read from stdin. * @@ -5,7 +7,7 @@ * @param data Uint8Array to store the data. */ export async function read(data: Uint8Array): Promise { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, Bun, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/read_dir.ts b/internal/runtime/read_dir.ts index 059d8b19..c33ff707 100644 --- a/internal/runtime/read_dir.ts +++ b/internal/runtime/read_dir.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Get directory list. * @@ -5,7 +7,7 @@ * @param path Path to the directory. */ export async function readDir(path: string): Promise> { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno } = globalThis as any; path ||= "."; diff --git a/internal/runtime/read_sync.ts b/internal/runtime/read_sync.ts index 24c5bfd7..bbde1753 100644 --- a/internal/runtime/read_sync.ts +++ b/internal/runtime/read_sync.ts @@ -1,4 +1,6 @@ -// dnt-shim-ignore deno-lint-ignore no-explicit-any +// deno-lint-ignore-file no-explicit-any + +// dnt-shim-ignore const { Deno, process, Buffer } = globalThis as any; const { readSync: readSyncNode } = process ? await import("node:fs") diff --git a/internal/runtime/set_env.ts b/internal/runtime/set_env.ts index 6e264b92..c7093432 100644 --- a/internal/runtime/set_env.ts +++ b/internal/runtime/set_env.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Set environment variable. * @@ -6,7 +8,7 @@ * @param value The value of the environment variable. */ export function setEnv(name: string, value: string): void { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/set_raw.ts b/internal/runtime/set_raw.ts index 0c7da31e..2bfc2958 100644 --- a/internal/runtime/set_raw.ts +++ b/internal/runtime/set_raw.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Set raw mode on stdin. * @@ -9,7 +11,7 @@ export function setRaw( mode: boolean, { cbreak }: { cbreak?: boolean } = {}, ): void { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/internal/runtime/stat.ts b/internal/runtime/stat.ts index 5e6fedd8..d96c68a2 100644 --- a/internal/runtime/stat.ts +++ b/internal/runtime/stat.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Get file info. * @@ -5,7 +7,7 @@ * @param input Path to the file. */ export async function stat(input: string): Promise<{ isDirectory: boolean }> { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno } = globalThis as any; if (Deno) { diff --git a/internal/runtime/write_sync.ts b/internal/runtime/write_sync.ts index 25e320a8..b39c02f0 100644 --- a/internal/runtime/write_sync.ts +++ b/internal/runtime/write_sync.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + /** * Write data to stdout. * @@ -5,7 +7,7 @@ * @param data Data to write to stdout. */ export function writeSync(data: Uint8Array): number { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const { Deno, process } = globalThis as any; if (Deno) { diff --git a/prompt/_generic_suggestions.ts b/prompt/_generic_suggestions.ts index 256fe9e0..5ede1216 100644 --- a/prompt/_generic_suggestions.ts +++ b/prompt/_generic_suggestions.ts @@ -1,3 +1,5 @@ +// deno-lint-ignore-file no-explicit-any + import type { KeyCode } from "@cliffy/keycode"; import { bold, @@ -136,7 +138,7 @@ export abstract class GenericSuggestions // Keep support for deno < 1.10. if (this.settings.id && "localStorage" in window) { try { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore return (window as any).localStorage; } catch (_) { // Ignore error if --location is not set. @@ -171,7 +173,7 @@ export abstract class GenericSuggestions protected override async render(): Promise { if (this.settings.files && this.#hasReadPermissions === undefined) { - // dnt-shim-ignore deno-lint-ignore no-explicit-any + // dnt-shim-ignore const status = await (globalThis as any).Deno?.permissions.request({ name: "read", });