editor/code: Enable noPropertyAccessFromIndexSignature ts option

This commit is contained in:
Tetsuharu Ohzeki 2023-06-28 18:15:30 +09:00
parent 72a3883a71
commit f70845305f
6 changed files with 9 additions and 9 deletions

View File

@ -36,7 +36,7 @@ async function getServer(
config: Config, config: Config,
state: PersistentState state: PersistentState
): Promise<string | undefined> { ): Promise<string | undefined> {
const explicitPath = process.env.__RA_LSP_SERVER_DEBUG ?? config.serverPath; const explicitPath = process.env["__RA_LSP_SERVER_DEBUG"] ?? config.serverPath;
if (explicitPath) { if (explicitPath) {
if (explicitPath.startsWith("~/")) { if (explicitPath.startsWith("~/")) {
return os.homedir() + explicitPath.slice("~".length); return os.homedir() + explicitPath.slice("~".length);

View File

@ -339,7 +339,7 @@ export function substituteVariablesInEnv(env: Env): Env {
const depRe = new RegExp(/\${(?<depName>.+?)}/g); const depRe = new RegExp(/\${(?<depName>.+?)}/g);
let match = undefined; let match = undefined;
while ((match = depRe.exec(value))) { while ((match = depRe.exec(value))) {
const depName = unwrapUndefinable(match.groups?.depName); const depName = unwrapUndefinable(match.groups?.["depName"]);
deps.add(depName); deps.add(depName);
// `depName` at this point can have a form of `expression` or // `depName` at this point can have a form of `expression` or
// `prefix:expression` // `prefix:expression`
@ -448,7 +448,7 @@ function computeVscodeVar(varName: string): string | null {
// https://github.com/microsoft/vscode/blob/08ac1bb67ca2459496b272d8f4a908757f24f56f/src/vs/workbench/api/common/extHostVariableResolverService.ts#L81 // https://github.com/microsoft/vscode/blob/08ac1bb67ca2459496b272d8f4a908757f24f56f/src/vs/workbench/api/common/extHostVariableResolverService.ts#L81
// or // or
// https://github.com/microsoft/vscode/blob/29eb316bb9f154b7870eb5204ec7f2e7cf649bec/src/vs/server/node/remoteTerminalChannel.ts#L56 // https://github.com/microsoft/vscode/blob/29eb316bb9f154b7870eb5204ec7f2e7cf649bec/src/vs/server/node/remoteTerminalChannel.ts#L56
execPath: () => process.env.VSCODE_EXEC_PATH ?? process.execPath, execPath: () => process.env["VSCODE_EXEC_PATH"] ?? process.execPath,
pathSeparator: () => path.sep, pathSeparator: () => path.sep,
}; };

View File

@ -147,8 +147,9 @@ async function getDebugConfiguration(
debugConfig.name = `run ${path.basename(executable)}`; debugConfig.name = `run ${path.basename(executable)}`;
} }
if (debugConfig.cwd) { const cwd = debugConfig["cwd"];
debugConfig.cwd = simplifyPath(debugConfig.cwd); if (cwd) {
debugConfig["cwd"] = simplifyPath(cwd);
} }
return debugConfig; return debugConfig;

View File

@ -176,7 +176,7 @@ export const getPathForExecutable = memoizeAsync(
); );
async function lookupInPath(exec: string): Promise<boolean> { async function lookupInPath(exec: string): Promise<boolean> {
const paths = process.env.PATH ?? ""; const paths = process.env["PATH"] ?? "";
const candidates = paths.split(path.delimiter).flatMap((dirInPath) => { const candidates = paths.split(path.delimiter).flatMap((dirInPath) => {
const candidate = path.join(dirInPath, exec); const candidate = path.join(dirInPath, exec);

View File

@ -57,7 +57,7 @@ export async function getTests(ctx: Context) {
USING_VSCODE_VAR: "${workspaceFolderBasename}", USING_VSCODE_VAR: "${workspaceFolderBasename}",
}; };
const actualEnv = await substituteVariablesInEnv(envJson); const actualEnv = await substituteVariablesInEnv(envJson);
assert.deepStrictEqual(actualEnv.USING_VSCODE_VAR, "code"); assert.deepStrictEqual(actualEnv["USING_VSCODE_VAR"], "code");
}); });
}); });
} }

View File

@ -13,8 +13,7 @@
// These disables some enhancement type checking options // These disables some enhancement type checking options
// to update typescript version without any code change. // to update typescript version without any code change.
"useUnknownInCatchVariables": false, "useUnknownInCatchVariables": false,
"exactOptionalPropertyTypes": false, "exactOptionalPropertyTypes": false
"noPropertyAccessFromIndexSignature": false
}, },
"exclude": ["node_modules", ".vscode-test"], "exclude": ["node_modules", ".vscode-test"],
"include": ["src", "tests"] "include": ["src", "tests"]