diff --git a/src/extension-api-utils/extensionHost.ts b/src/extension-api-utils/extensionHost.ts index 5dc50f0..6abd257 100644 --- a/src/extension-api-utils/extensionHost.ts +++ b/src/extension-api-utils/extensionHost.ts @@ -1,6 +1,7 @@ import * as vscode from "vscode"; declare const globalThis: { + // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; }; @@ -8,6 +9,7 @@ export interface HostWebviewPanel extends vscode.Disposable { readonly webview: vscode.Webview; readonly visible: boolean; reveal(viewColumn?: vscode.ViewColumn, preserveFocus?: boolean): void; + // eslint-disable-next-line @typescript-eslint/no-explicit-any readonly onDidChangeViewState: vscode.Event; readonly onDidDispose: vscode.Event; } @@ -53,6 +55,7 @@ export async function getPositronPreferredRuntime( return await pst.runtime.getPreferredRuntime(languageId); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any function getPositronAPI(): undefined | any { if (typeof globalThis?.acquirePositronApi !== "function") { return; diff --git a/src/extension-api-utils/getRemoteSafeUrl.ts b/src/extension-api-utils/getRemoteSafeUrl.ts index 40c3556..f5872d2 100644 --- a/src/extension-api-utils/getRemoteSafeUrl.ts +++ b/src/extension-api-utils/getRemoteSafeUrl.ts @@ -1,4 +1,3 @@ -/* eslint-disable curly */ /* eslint-disable @typescript-eslint/naming-convention */ // From https://github.com/rstudio/shinyuieditor/blob/392659a0d936e4e38ac99660e89b0327db45b3a9/inst/vscode-extension/src/extension-api-utils/getRemoteSafeUrl.ts diff --git a/src/extension-api-utils/runShellCommand.ts b/src/extension-api-utils/runShellCommand.ts index 7ae5fb6..d052f6d 100644 --- a/src/extension-api-utils/runShellCommand.ts +++ b/src/extension-api-utils/runShellCommand.ts @@ -1,4 +1,3 @@ -/* eslint-disable curly */ /* eslint-disable @typescript-eslint/naming-convention */ // From https://github.com/rstudio/shinyuieditor/blob/392659a0d936e4e38ac99660e89b0327db45b3a9/inst/vscode-extension/src/extension-api-utils/runShellCommand.ts @@ -50,10 +49,12 @@ export async function runShellCommand({ cleanup(); resolve({ status: "success", ...output }); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any function onStdout(d: any) { logger(`stdout: ${d.toString()}`); output.stdout.push(d.toString()); } + // eslint-disable-next-line @typescript-eslint/no-explicit-any function onStderr(d: any) { logger(`stderr: ${d.toString()}`); output.stderr.push(d.toString()); @@ -90,7 +91,6 @@ export async function runShellCommand({ function makeLogger(verbose: boolean, prefix: string) { return (msg: string) => { if (verbose) { - // eslint-disable-next-line no-console console.log(prefix + msg); } }; diff --git a/src/extension.ts b/src/extension.ts index ea9bcdb..1ae183a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -26,8 +26,8 @@ export function activate(context: vscode.ExtensionContext) { shinyliveCreateFromExplorer ), vscode.window.registerUriHandler({ - handleUri(uri: vscode.Uri): vscode.ProviderResult { - handlePositShinyUri(uri); + async handleUri(uri: vscode.Uri): Promise { + await handlePositShinyUri(uri); }, }) ); diff --git a/src/net-utils.ts b/src/net-utils.ts index db6795b..10244e8 100644 --- a/src/net-utils.ts +++ b/src/net-utils.ts @@ -1,6 +1,6 @@ import * as http from "http"; +import type { AddressInfo } from "net"; import * as net from "net"; -import { AddressInfo } from "net"; import * as vscode from "vscode"; import { getExtensionHostPreview } from "./extension-api-utils/extensionHost"; import { getRemoteSafeUrl } from "./extension-api-utils/getRemoteSafeUrl"; @@ -138,7 +138,7 @@ export async function openBrowserWhenReady( return; } - let previewUrl = await getRemoteSafeUrl(port); + const previewUrl = await getRemoteSafeUrl(port); await openBrowser(previewUrl); } @@ -162,7 +162,7 @@ export async function openBrowser(url: string): Promise { vscode.env.openExternal(vscode.Uri.parse(url)); return; } - // @ts-ignore-next-line + // @ts-expect-error Fallthrough case in switch case "internal": { const hostPreview = getExtensionHostPreview(); if (hostPreview) { @@ -200,7 +200,7 @@ export async function suggestPort(): Promise { if (!UNSAFE_PORTS.includes(port)) { return port; } - } while (true); + } while (true); // eslint-disable-line no-constant-condition } async function closeServer(server: http.Server): Promise { diff --git a/src/run.ts b/src/run.ts index be67db1..1130da7 100644 --- a/src/run.ts +++ b/src/run.ts @@ -62,7 +62,7 @@ export async function pyRunApp(): Promise { // Clear out the browser. Without this it can be a little confusing as to // whether the app is trying to load or not. - openBrowser("about:blank"); + await openBrowser("about:blank"); // If we start too quickly, openBrowserWhenReady may detect the old Shiny // process (in the process of shutting down), not the new one. Give it a // second. It's a shame to wait an extra second, but it's only when the Play @@ -185,7 +185,7 @@ export async function rRunApp(): Promise { // Clear out the browser. Without this it can be a little confusing as to // whether the app is trying to load or not. - openBrowser("about:blank"); + await openBrowser("about:blank"); // If we start too quickly, openBrowserWhenReady may detect the old Shiny // process (in the process of shutting down), not the new one. Give it a // second. It's a shame to wait an extra second, but it's only when the Play diff --git a/src/shinylive.ts b/src/shinylive.ts index 8ab813c..ae125db 100644 --- a/src/shinylive.ts +++ b/src/shinylive.ts @@ -481,7 +481,7 @@ async function askUserForOutputFile( * selected directory, or `undefined` if the user canceled the selection. */ async function askUserForOutputDirectory(): Promise { - let defaultUri = lastUsedDir || vscode.workspace.workspaceFolders?.[0].uri; + const defaultUri = lastUsedDir || vscode.workspace.workspaceFolders?.[0].uri; const uri = await vscode.window.showSaveDialog({ defaultUri: defaultUri, @@ -664,6 +664,7 @@ async function askUserToConfirmOverwrite(filePath: vscode.Uri) { async function pathExists(file: vscode.Uri): Promise { try { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions typeof (await vscode.workspace.fs.stat(file)).type !== "undefined"; return true; } catch (error) { diff --git a/src/test/runTest.ts b/src/test/runTest.ts index e810ed5..0ead300 100644 --- a/src/test/runTest.ts +++ b/src/test/runTest.ts @@ -20,4 +20,5 @@ async function main() { } } +// eslint-disable-next-line @typescript-eslint/no-floating-promises main();