diff --git a/extensions/ql-vscode/eslint.config.mjs b/extensions/ql-vscode/eslint.config.mjs index 9496fb03876..e453a1f9838 100644 --- a/extensions/ql-vscode/eslint.config.mjs +++ b/extensions/ql-vscode/eslint.config.mjs @@ -69,7 +69,6 @@ export default tseslint.config( // Rules disabled during eslint 9 migration "github/filenames-match-regex": "off", - "@typescript-eslint/restrict-template-expressions": "off", "@typescript-eslint/no-unsafe-assignment": "off", "@typescript-eslint/no-unsafe-argument": "off", "@typescript-eslint/no-unsafe-member-access": "off", diff --git a/extensions/ql-vscode/src/codeql-cli/cli.ts b/extensions/ql-vscode/src/codeql-cli/cli.ts index 2074f0d7dec..27a61c4a143 100644 --- a/extensions/ql-vscode/src/codeql-cli/cli.ts +++ b/extensions/ql-vscode/src/codeql-cli/cli.ts @@ -314,7 +314,7 @@ export class CodeQLCliServer implements Disposable { } catch (e) { // We are probably fine here, the process has already closed stdin. void this.logger.log( - `Shutdown request failed: process stdin may have already closed. The error was ${e}`, + `Shutdown request failed: process stdin may have already closed. The error was ${getErrorMessage(e)}`, ); void this.logger.log("Stopping the process anyway."); } @@ -748,7 +748,7 @@ export class CodeQLCliServer implements Disposable { } else { reject( new Error( - `${command} ${commandArgs.join(" ")} failed with code ${code}`, + `${command.join(" ")} ${commandArgs.join(" ")} failed with code ${code}`, ), ); } diff --git a/extensions/ql-vscode/src/codeql-cli/distribution.ts b/extensions/ql-vscode/src/codeql-cli/distribution.ts index ba3050ca904..35bbb7acf16 100644 --- a/extensions/ql-vscode/src/codeql-cli/distribution.ts +++ b/extensions/ql-vscode/src/codeql-cli/distribution.ts @@ -385,7 +385,7 @@ class ExtensionSpecificDistributionManager { } catch (e) { void extLogger.log( "WARNING: Tried to remove corrupted CodeQL CLI at " + - `${this.getDistributionStoragePath()} but encountered an error: ${e}.`, + `${this.getDistributionStoragePath()} but encountered an error: ${getErrorMessage(e)}.`, ); } } @@ -457,7 +457,7 @@ class ExtensionSpecificDistributionManager { } catch (e) { void extLogger.log( `Tried to clean up old version of CLI at ${this.getDistributionStoragePath()} ` + - `but encountered an error: ${e}.`, + `but encountered an error: ${getErrorMessage(e)}.`, ); } diff --git a/extensions/ql-vscode/src/codeql-cli/query-language.ts b/extensions/ql-vscode/src/codeql-cli/query-language.ts index 17430ee06a5..d5cef76e697 100644 --- a/extensions/ql-vscode/src/codeql-cli/query-language.ts +++ b/extensions/ql-vscode/src/codeql-cli/query-language.ts @@ -89,7 +89,7 @@ export async function askForLanguage( if (!isQueryLanguage(language)) { void showAndLogErrorMessage( extLogger, - `Language '${language}' is not supported. Only languages ${Object.values( + `Language '${language as string}' is not supported. Only languages ${Object.values( QueryLanguage, ).join(", ")} are supported.`, ); diff --git a/extensions/ql-vscode/src/codeql-cli/query-metadata.ts b/extensions/ql-vscode/src/codeql-cli/query-metadata.ts index 0991bf952d3..88fe52d49ba 100644 --- a/extensions/ql-vscode/src/codeql-cli/query-metadata.ts +++ b/extensions/ql-vscode/src/codeql-cli/query-metadata.ts @@ -1,6 +1,7 @@ import type { CodeQLCliServer } from "./cli"; import type { QueryMetadata } from "../common/interface-types"; import { extLogger } from "../common/logging/vscode"; +import { getErrorMessage } from "../common/helpers-pure"; /** * Gets metadata for a query, if it exists. @@ -16,7 +17,9 @@ export async function tryGetQueryMetadata( return await cliServer.resolveMetadata(queryPath); } catch (e) { // Ignore errors and provide no metadata. - void extLogger.log(`Couldn't resolve metadata for ${queryPath}: ${e}`); + void extLogger.log( + `Couldn't resolve metadata for ${queryPath}: ${getErrorMessage(e)}`, + ); return; } } diff --git a/extensions/ql-vscode/src/common/short-paths.ts b/extensions/ql-vscode/src/common/short-paths.ts index 0025b96da05..860544c38d4 100644 --- a/extensions/ql-vscode/src/common/short-paths.ts +++ b/extensions/ql-vscode/src/common/short-paths.ts @@ -92,12 +92,12 @@ async function expandShortPathComponent( } } catch (e) { // Can't read stats for the child, so skip it. - void logger.log(`Error reading stats for child: ${e}`); + void logger.log(`Error reading stats for child: ${getErrorMessage(e)}`); } } } catch (e) { // Can't read the directory, so we won't be able to find this in the directory listing. - void logger.log(`Error reading directory: ${e}`); + void logger.log(`Error reading directory: ${getErrorMessage(e)}`); return shortBase; } diff --git a/extensions/ql-vscode/src/common/vscode/archive-filesystem-provider.ts b/extensions/ql-vscode/src/common/vscode/archive-filesystem-provider.ts index c82225f42f1..1ee61468c36 100644 --- a/extensions/ql-vscode/src/common/vscode/archive-filesystem-provider.ts +++ b/extensions/ql-vscode/src/common/vscode/archive-filesystem-provider.ts @@ -135,7 +135,7 @@ const sourceArchiveUriAuthorityPattern = /^(\d+)-(\d+)$/; class InvalidSourceArchiveUriError extends Error { constructor(uri: Uri) { super( - `Can't decode uri ${uri}: authority should be of the form startIndex-endIndex (where both indices are integers).`, + `Can't decode uri ${uri.toString()}: authority should be of the form startIndex-endIndex (where both indices are integers).`, ); } } diff --git a/extensions/ql-vscode/src/common/vscode/webview-html.ts b/extensions/ql-vscode/src/common/vscode/webview-html.ts index 9a02714f726..e1eac40024c 100644 --- a/extensions/ql-vscode/src/common/vscode/webview-html.ts +++ b/extensions/ql-vscode/src/common/vscode/webview-html.ts @@ -89,7 +89,7 @@ export function getHtmlForWebview(