Skip to content

Commit 372f544

Browse files
fix(vscode): fix ESLint errors
- Import exec from child_process at module level - Use node: protocol for Node.js built-in modules - Fix TypeScript types for error parameters - Remove unused catch parameters
1 parent 8993f06 commit 372f544

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

raz-adapters/vscode/src/extension.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as fs from "node:fs";
77
import * as https from "node:https";
88
import * as zlib from "node:zlib";
99
import * as tar from "tar";
10+
import { exec } from "node:child_process";
1011
import { registerTaskProvider, executeRazAsTask } from "./taskProvider";
1112
import { executeWithDebuggingSupport, registerDebugCommands } from "./debugger";
1213

@@ -112,8 +113,7 @@ class RazBinaryManager {
112113
}
113114

114115
return new Promise((resolve) => {
115-
const { exec } = require('child_process');
116-
exec(`"${binaryPath}" --version`, (error: any, stdout: string, stderr: string) => {
116+
exec(`"${binaryPath}" --version`, (error: Error | null, stdout: string, _stderr: string) => {
117117
if (error) {
118118
this.outputChannel.appendLine(`Failed to get binary version: ${error}`);
119119
resolve(null);
@@ -420,8 +420,7 @@ async function checkForUpdates(context: vscode.ExtensionContext): Promise<void>
420420
/// Get RAZ version from system PATH
421421
async function getRazVersion(): Promise<string | null> {
422422
return new Promise((resolve) => {
423-
const { exec } = require('child_process');
424-
exec('raz --version', (error: any, stdout: string) => {
423+
exec('raz --version', (error: Error | null, stdout: string) => {
425424
if (error) {
426425
resolve(null);
427426
return;
@@ -622,7 +621,7 @@ export async function activate(
622621
const binaryManager = new RazBinaryManager(context, outputChannel);
623622
const latestVersion = await binaryManager.getLatestVersion();
624623
vscode.env.openExternal(vscode.Uri.parse(`https://github.com/codeitlikemiley/raz/releases/tag/${latestVersion}`));
625-
} catch (error) {
624+
} catch {
626625
vscode.env.openExternal(vscode.Uri.parse("https://github.com/codeitlikemiley/raz/releases/latest"));
627626
}
628627
}
@@ -652,10 +651,10 @@ export async function activate(
652651
// Note: cleanupOldBinaries method may not exist in newer versions
653652
try {
654653
const binaryManager = new RazBinaryManager(context, outputChannel);
655-
if (typeof (binaryManager as any).cleanupOldBinaries === 'function') {
656-
await (binaryManager as any).cleanupOldBinaries();
654+
if (typeof (binaryManager as unknown as {cleanupOldBinaries?: () => Promise<void>}).cleanupOldBinaries === 'function') {
655+
await (binaryManager as unknown as {cleanupOldBinaries: () => Promise<void>}).cleanupOldBinaries();
657656
}
658-
} catch (e) {
657+
} catch {
659658
// Ignore if method doesn't exist
660659
}
661660

0 commit comments

Comments
 (0)