Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Nov 12, 2024
1 parent 42205e0 commit 58ecdb8
Show file tree
Hide file tree
Showing 21 changed files with 63 additions and 22 deletions.
1 change: 1 addition & 0 deletions command/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion command/upgrade/get_runtime.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -9,7 +11,7 @@ export interface GetRuntimeResult {

/** Get runtime handler for current runtime. */
export async function getRuntime(): Promise<GetRuntimeResult> {
// dnt-shim-ignore deno-lint-ignore no-explicit-any
// dnt-shim-ignore
const { Deno, process } = globalThis as any;

if (Deno?.version?.deno) {
Expand Down
6 changes: 4 additions & 2 deletions command/upgrade/runtime/bun_runtime.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -8,9 +10,9 @@ export class BunRuntime extends NodeRuntime {
isJsr: boolean,
logger?: Logger,
): Promise<void> {
// 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
Expand Down
4 changes: 3 additions & 1 deletion command/upgrade/spinner.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/delete_env.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Delete environment variable.
*
* @internal
* @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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/exit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Exit the current process with optional exit code.
*
* @internal
* @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;

Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/get_args.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// deno-lint-ignore-file no-explicit-any

/**
* Get script arguments.
*
* @internal
*/
export function getArgs(): Array<string> {
// 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) ?? [];
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/get_columns.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Returns the width of the console window.
*
* @internal
*/
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)
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/get_env.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Get environment variable.
*
* @internal
* @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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/get_os.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// deno-lint-ignore-file no-explicit-any

/**
* Get operating system name.
*
Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/inspect.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/is_terminal.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/no_color.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/read.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Read from stdin.
*
* @internal
* @param data Uint8Array to store the data.
*/
export async function read(data: Uint8Array): Promise<number | null> {
// dnt-shim-ignore deno-lint-ignore no-explicit-any
// dnt-shim-ignore
const { Deno, Bun, process } = globalThis as any;

if (Deno) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/read_dir.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Get directory list.
*
* @internal
* @param path Path to the directory.
*/
export async function readDir(path: string): Promise<Array<{ name: string }>> {
// dnt-shim-ignore deno-lint-ignore no-explicit-any
// dnt-shim-ignore
const { Deno } = globalThis as any;
path ||= ".";

Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/read_sync.ts
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/set_env.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// deno-lint-ignore-file no-explicit-any

/**
* Set environment variable.
*
Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/set_raw.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// deno-lint-ignore-file no-explicit-any

/**
* Set raw mode on stdin.
*
Expand All @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/stat.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Get file info.
*
* @internal
* @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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/runtime/write_sync.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// deno-lint-ignore-file no-explicit-any

/**
* Write data to stdout.
*
* @internal
* @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) {
Expand Down
6 changes: 4 additions & 2 deletions prompt/_generic_suggestions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// deno-lint-ignore-file no-explicit-any

import type { KeyCode } from "@cliffy/keycode";
import {
bold,
Expand Down Expand Up @@ -136,7 +138,7 @@ export abstract class GenericSuggestions<TValue, TRawValue>
// 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.
Expand Down Expand Up @@ -171,7 +173,7 @@ export abstract class GenericSuggestions<TValue, TRawValue>

protected override async render(): Promise<void> {
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",
});
Expand Down

0 comments on commit 58ecdb8

Please sign in to comment.