From 8e7b161ab70bbadbb3e81983c90886403cb86b2d Mon Sep 17 00:00:00 2001 From: Tobias Ortmayr Date: Wed, 22 Nov 2023 03:47:23 -0800 Subject: [PATCH] Remove baseUrl from tsconfigs (#12981) According to the [tsconfig doc](https://www.typescriptlang.org/tsconfig#baseUrl): This feature was designed for use in conjunction with AMD module loaders in the browser, and is not recommended in any other context. As of TypeScript 4.1, baseUrl is no longer required to be set when using paths. In addition, this options does not work well with auto import resolving of Typescript-LSPs (i.e. Theia/VS Code). Auto import might resolves to a statement starting with `src` ( e.g. ` import { ChannelMultiplexer } from 'src/common/message-rpc/channel';`) which does not work well with inversify and can result in runtime errors Most of the packages don't use it anyways. This PR removes the remaining usages and adapts `src` imports. --- examples/playwright/src/tests/theia-output-view.test.ts | 2 +- examples/playwright/tsconfig.json | 3 +-- .../window/electron-secondary-window-service.ts | 2 +- packages/core/src/node/i18n/localization-server.ts | 2 +- packages/core/tsconfig.json | 3 +-- packages/filesystem/tsconfig.json | 5 ++--- packages/messages/tsconfig.json | 3 +-- packages/preview/tsconfig.json | 3 +-- 8 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/playwright/src/tests/theia-output-view.test.ts b/examples/playwright/src/tests/theia-output-view.test.ts index c991081d751b0..6906ed503be9d 100644 --- a/examples/playwright/src/tests/theia-output-view.test.ts +++ b/examples/playwright/src/tests/theia-output-view.test.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { expect } from '@playwright/test'; -import { TheiaOutputViewChannel } from 'src/theia-output-channel'; +import { TheiaOutputViewChannel } from '../theia-output-channel'; import { TheiaApp } from '../theia-app'; import { TheiaOutputView } from '../theia-output-view'; import test, { page } from './fixtures/theia-fixture'; diff --git a/examples/playwright/tsconfig.json b/examples/playwright/tsconfig.json index 697dca2f2fb17..b973ddbc673a2 100644 --- a/examples/playwright/tsconfig.json +++ b/examples/playwright/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "composite": true, "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "outDir": "lib" }, "include": [ "src" diff --git a/packages/core/src/electron-browser/window/electron-secondary-window-service.ts b/packages/core/src/electron-browser/window/electron-secondary-window-service.ts index bcaae900e9915..a5bd35cdca469 100644 --- a/packages/core/src/electron-browser/window/electron-secondary-window-service.ts +++ b/packages/core/src/electron-browser/window/electron-secondary-window-service.ts @@ -16,7 +16,7 @@ import { injectable } from 'inversify'; import { DefaultSecondaryWindowService } from '../../browser/window/default-secondary-window-service'; -import { ApplicationShell, ExtractableWidget } from 'src/browser'; +import { ApplicationShell, ExtractableWidget } from '../../browser'; @injectable() export class ElectronSecondaryWindowService extends DefaultSecondaryWindowService { diff --git a/packages/core/src/node/i18n/localization-server.ts b/packages/core/src/node/i18n/localization-server.ts index 539617ca6075e..77483c80c99ff 100644 --- a/packages/core/src/node/i18n/localization-server.ts +++ b/packages/core/src/node/i18n/localization-server.ts @@ -15,7 +15,7 @@ // ***************************************************************************** import { inject, injectable } from 'inversify'; -import { Localization } from 'src/common/i18n/localization'; +import { Localization } from '../../common/i18n/localization'; import { LocalizationServer } from '../../common/i18n/localization-server'; import { nls } from '../../common/nls'; import { Deferred } from '../../common/promise-util'; diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index e490a71167a54..e2b789d29ef8d 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "composite": true, "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "outDir": "lib" }, "include": [ "src" diff --git a/packages/filesystem/tsconfig.json b/packages/filesystem/tsconfig.json index 732a9aaaf62e0..b894a97d0011a 100644 --- a/packages/filesystem/tsconfig.json +++ b/packages/filesystem/tsconfig.json @@ -4,13 +4,12 @@ "composite": true, "rootDir": "src", "outDir": "lib", - "baseUrl": ".", "paths": { "mv": [ - "src/typings/mv" + "./src/typings/mv" ], "trash": [ - "src/typings/trash" + "./src/typings/trash" ] } }, diff --git a/packages/messages/tsconfig.json b/packages/messages/tsconfig.json index c6c969e090366..b623c1e105ac7 100644 --- a/packages/messages/tsconfig.json +++ b/packages/messages/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "composite": true, "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "outDir": "lib" }, "include": [ "src" diff --git a/packages/preview/tsconfig.json b/packages/preview/tsconfig.json index 158f441bc6b1b..2e1b755327559 100644 --- a/packages/preview/tsconfig.json +++ b/packages/preview/tsconfig.json @@ -3,8 +3,7 @@ "compilerOptions": { "composite": true, "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "outDir": "lib" }, "include": [ "src"