Add lint rule for as any and bulk ignore all existing breaks

For #269213

This adds a new eslint rule for `as any` and `<any>({... })`. We'd like to remove almost all of these, however right now the first goal is to prevent them in new code. That's why with this first PR I simply add `eslint-disable` comments for all breaks

Trying to get this change in soon after branching off for release to hopefully minimize disruption during debt week work
This commit is contained in:
Matt Bierner
2025-10-02 23:38:33 -07:00
parent 96aa43fe7a
commit 360c9fd134
465 changed files with 1188 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ function createServerHost(
const fs = apiClient?.vscode.workspace.fileSystem;
// Internals
// eslint-disable-next-line local/code-no-any-casts
const combinePaths: (path: string, ...paths: (string | undefined)[]) => string = (ts as any).combinePaths;
const byteOrderMarkIndicator = '\uFEFF';
const matchFiles: (
@@ -41,13 +42,19 @@ function createServerHost(
depth: number | undefined,
getFileSystemEntries: (path: string) => { files: readonly string[]; directories: readonly string[] },
realpath: (path: string) => string
// eslint-disable-next-line local/code-no-any-casts
) => string[] = (ts as any).matchFiles;
// eslint-disable-next-line local/code-no-any-casts
const generateDjb2Hash = (ts as any).generateDjb2Hash;
// Legacy web
// eslint-disable-next-line local/code-no-any-casts
const memoize: <T>(callback: () => T) => () => T = (ts as any).memoize;
// eslint-disable-next-line local/code-no-any-casts
const ensureTrailingDirectorySeparator: (path: string) => string = (ts as any).ensureTrailingDirectorySeparator;
// eslint-disable-next-line local/code-no-any-casts
const getDirectoryPath: (path: string) => string = (ts as any).getDirectoryPath;
// eslint-disable-next-line local/code-no-any-casts
const directorySeparator: string = (ts as any).directorySeparator;
const executingFilePath = findArgument(args, '--executingFilePath') || location + '';
const getExecutingDirectoryPath = memoize(() => memoize(() => ensureTrailingDirectorySeparator(getDirectoryPath(executingFilePath))));

View File

@@ -13,6 +13,7 @@ import { createSys } from './serverHost';
import { findArgument, findArgumentStringArray, hasArgument, parseServerMode } from './util/args';
import { StartSessionOptions, startWorkerSession } from './workerSession';
// eslint-disable-next-line local/code-no-any-casts
const setSys: (s: ts.System) => void = (ts as any).setSys;
async function initializeSession(

View File

@@ -31,6 +31,7 @@ export function startWorkerSession(
pathMapper: PathMapper,
logger: Logger,
): void {
// eslint-disable-next-line local/code-no-any-casts
const indent: (str: string) => string = (ts as any).server.indent;
const worker = new class WorkerSession extends ts.server.Session<{}> {