fix(api): fix lint errors in lazy node-pty import types
All checks were successful
ci/woodpecker/push/api Pipeline was successful
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Use proper import type instead of inline import() type annotations that violate @typescript-eslint/consistent-type-imports rule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,13 +14,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable, Logger, OnModuleInit } from "@nestjs/common";
|
import { Injectable, Logger, OnModuleInit } from "@nestjs/common";
|
||||||
|
import type { IPty } from "node-pty";
|
||||||
import type { Socket } from "socket.io";
|
import type { Socket } from "socket.io";
|
||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
|
|
||||||
// Lazy-loaded in onModuleInit via dynamic import() to prevent crash
|
// Lazy-loaded in onModuleInit via dynamic import() to prevent crash
|
||||||
// if the native binary is missing. node-pty requires a compiled .node
|
// if the native binary is missing. node-pty requires a compiled .node
|
||||||
// binary which may not be available in all Docker environments.
|
// binary which may not be available in all Docker environments.
|
||||||
type NodePtyModule = typeof import("node-pty");
|
interface NodePtyModule {
|
||||||
|
spawn: (file: string, args: string[], options: Record<string, unknown>) => IPty;
|
||||||
|
}
|
||||||
let pty: NodePtyModule | null = null;
|
let pty: NodePtyModule | null = null;
|
||||||
|
|
||||||
/** Maximum concurrent PTY sessions per workspace */
|
/** Maximum concurrent PTY sessions per workspace */
|
||||||
@@ -36,7 +39,7 @@ const DEFAULT_ROWS = 24;
|
|||||||
export interface TerminalSession {
|
export interface TerminalSession {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
pty: import("node-pty").IPty;
|
pty: IPty;
|
||||||
name?: string;
|
name?: string;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user