Skip to content

Commit

Permalink
Remove baseUrl from tsconfigs (#12981)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tortmayr authored Nov 22, 2023
1 parent c057a5b commit 8e7b161
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/playwright/src/tests/theia-output-view.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 1 addition & 2 deletions examples/playwright/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "lib",
"baseUrl": "."
"outDir": "lib"
},
"include": [
"src"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/node/i18n/localization-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 1 addition & 2 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "lib",
"baseUrl": "."
"outDir": "lib"
},
"include": [
"src"
Expand Down
5 changes: 2 additions & 3 deletions packages/filesystem/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
},
Expand Down
3 changes: 1 addition & 2 deletions packages/messages/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "lib",
"baseUrl": "."
"outDir": "lib"
},
"include": [
"src"
Expand Down
3 changes: 1 addition & 2 deletions packages/preview/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
"composite": true,
"rootDir": "src",
"outDir": "lib",
"baseUrl": "."
"outDir": "lib"
},
"include": [
"src"
Expand Down

0 comments on commit 8e7b161

Please sign in to comment.