From d553b158ed7ff3ffaf50591cf642a7c808504b47 Mon Sep 17 00:00:00 2001 From: gusthoff Date: Sat, 2 Nov 2024 22:44:26 +0100 Subject: [PATCH] Widget: use explicit .ts extension in imports --- frontend/src/ts/areas.ts | 4 ++-- frontend/src/ts/download.ts | 2 +- frontend/src/ts/server-types.ts | 2 +- frontend/src/ts/server.ts | 2 +- frontend/src/ts/widget.ts | 16 ++++++++-------- frontend/tests/ts/areas.spec.ts | 6 +++--- frontend/tests/ts/dom-utils.spec.ts | 2 +- frontend/tests/ts/download.spec.ts | 4 ++-- frontend/tests/ts/editor.spec.ts | 4 ++-- frontend/tests/ts/scrolltop.spec.ts | 2 +- frontend/tests/ts/server.spec.ts | 4 ++-- frontend/tests/ts/widget.spec.ts | 12 ++++++------ frontend/tsconfig.json | 1 + 13 files changed, 31 insertions(+), 30 deletions(-) diff --git a/frontend/src/ts/areas.ts b/frontend/src/ts/areas.ts index 66458ddc0..409bc520f 100644 --- a/frontend/src/ts/areas.ts +++ b/frontend/src/ts/areas.ts @@ -1,5 +1,5 @@ -import * as Strings from './strings'; -import {CheckOutput} from './server-types'; +import * as Strings from './strings.ts'; +import {CheckOutput} from './server-types.ts'; /** Class representing an Area */ export class Area { diff --git a/frontend/src/ts/download.ts b/frontend/src/ts/download.ts index a0856a7dd..ef249dba1 100644 --- a/frontend/src/ts/download.ts +++ b/frontend/src/ts/download.ts @@ -1,6 +1,6 @@ import JSZip from 'jszip'; import FileSaver from 'file-saver'; -import {ResourceList} from './resource'; +import {ResourceList} from './resource.ts'; const COMMON_ADC = `pragma Restrictions (No_Specification_of_Aspect => Import); pragma Restrictions (No_Use_Of_Pragma => Import); diff --git a/frontend/src/ts/server-types.ts b/frontend/src/ts/server-types.ts index 0478b7d24..7b1de8fd5 100644 --- a/frontend/src/ts/server-types.ts +++ b/frontend/src/ts/server-types.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import {ResourceList} from './resource'; +import {ResourceList} from './resource.ts'; // FS - From Server // TS - To Server diff --git a/frontend/src/ts/server.ts b/frontend/src/ts/server.ts index 67d3ddb60..85ad699bc 100644 --- a/frontend/src/ts/server.ts +++ b/frontend/src/ts/server.ts @@ -1,4 +1,4 @@ -import {RunProgram, CheckOutput} from './server-types'; +import {RunProgram, CheckOutput} from './server-types.ts'; /** * Worker class for server REST sequence diff --git a/frontend/src/ts/widget.ts b/frontend/src/ts/widget.ts index 5fb011cdf..2860de3ae 100644 --- a/frontend/src/ts/widget.ts +++ b/frontend/src/ts/widget.ts @@ -1,15 +1,15 @@ import cookies from 'typescript-cookies'; -import {Area, OutputArea, LabContainer} from './areas'; -import {Editor, EditorTheme} from './editor'; +import {Area, OutputArea, LabContainer} from './areas.ts'; +import {Editor, EditorTheme} from './editor.ts'; import {getElemsByClass, getElemById, getElemsByTag} - from './dom-utils'; + from './dom-utils.ts'; import {downloadProject, UnparsedSwitches, - getUnparsedSwitches} from './download'; -import {Resource, ResourceList} from './resource'; -import {ServerWorker} from './server'; -import {RunProgram, CheckOutput} from './server-types'; -import * as Strings from './strings'; + getUnparsedSwitches} from './download.ts'; +import {Resource, ResourceList} from './resource.ts'; +import {ServerWorker} from './server.ts'; +import {RunProgram, CheckOutput} from './server-types.ts'; +import * as Strings from './strings.ts'; interface EditorView { readonly header: HTMLButtonElement; diff --git a/frontend/tests/ts/areas.spec.ts b/frontend/tests/ts/areas.spec.ts index 0938fdd27..8dcd1bbc0 100644 --- a/frontend/tests/ts/areas.spec.ts +++ b/frontend/tests/ts/areas.spec.ts @@ -5,9 +5,9 @@ chai.use(chaiDom); // Import package under test import {Area, OutputArea, LabArea, makeLabArea, LabContainer} - from '../../src/ts/areas'; -import * as Strings from '../../src/ts/strings'; -import {CheckOutput} from '../../src/ts/server-types'; + from '../../src/ts/areas.ts'; +import * as Strings from '../../src/ts/strings.ts'; +import {CheckOutput} from '../../src/ts/server-types.ts'; describe('Area', () => { let parent: HTMLDivElement; diff --git a/frontend/tests/ts/dom-utils.spec.ts b/frontend/tests/ts/dom-utils.spec.ts index c2649f1f8..af7f477c5 100644 --- a/frontend/tests/ts/dom-utils.spec.ts +++ b/frontend/tests/ts/dom-utils.spec.ts @@ -5,7 +5,7 @@ import chaiDom from 'chai-dom'; chai.use(chaiDom); import {getElemById, getElemsByClass, getElemsByTag} - from '../../src/ts/dom-utils'; + from '../../src/ts/dom-utils.ts'; describe('getElemById()', () => { const id = 'test-div'; diff --git a/frontend/tests/ts/download.spec.ts b/frontend/tests/ts/download.spec.ts index 35f96a6e6..3044353a0 100644 --- a/frontend/tests/ts/download.spec.ts +++ b/frontend/tests/ts/download.spec.ts @@ -8,8 +8,8 @@ import { findMains, getMain, getGprContents, -} from '../../src/ts/download'; -import {ResourceList} from '../../src/ts/resource'; +} from '../../src/ts/download.ts'; +import {ResourceList} from '../../src/ts/resource.ts'; describe('Download', () => { describe('#getLanguages()', () => { diff --git a/frontend/tests/ts/editor.spec.ts b/frontend/tests/ts/editor.spec.ts index 55182a6b5..c6a95abde 100644 --- a/frontend/tests/ts/editor.spec.ts +++ b/frontend/tests/ts/editor.spec.ts @@ -6,8 +6,8 @@ chai.use(chaiDom); import ace from 'brace'; -import {Editor, EditorTheme} from '../../src/ts/editor'; -import {Resource} from '../../src/ts/resource'; +import {Editor, EditorTheme} from '../../src/ts/editor.ts'; +import {Resource} from '../../src/ts/resource.ts'; describe('Editor', () => { let inTest: Editor; diff --git a/frontend/tests/ts/scrolltop.spec.ts b/frontend/tests/ts/scrolltop.spec.ts index f57232baf..13db18ce9 100644 --- a/frontend/tests/ts/scrolltop.spec.ts +++ b/frontend/tests/ts/scrolltop.spec.ts @@ -4,7 +4,7 @@ import chaiDom from 'chai-dom'; chai.use(chaiDom); -import {scrollTop} from '../../src/ts/scrolltop'; +import {scrollTop} from '../../src/ts/scrolltop.ts'; /** * Helper function to trigger window event diff --git a/frontend/tests/ts/server.spec.ts b/frontend/tests/ts/server.spec.ts index 25c2a8f7c..b20a2d382 100644 --- a/frontend/tests/ts/server.spec.ts +++ b/frontend/tests/ts/server.spec.ts @@ -5,8 +5,8 @@ chai.use(chaiAsPromised); import {Server, WebSocket} from 'mock-socket'; -import {ServerWorker} from '../../src/ts/server'; -import {CheckOutput, RunProgram} from '../../src/ts/server-types'; +import {ServerWorker} from '../../src/ts/server.ts'; +import {CheckOutput, RunProgram} from '../../src/ts/server-types.ts'; global.WebSocket = WebSocket; diff --git a/frontend/tests/ts/widget.spec.ts b/frontend/tests/ts/widget.spec.ts index 371057391..410284219 100644 --- a/frontend/tests/ts/widget.spec.ts +++ b/frontend/tests/ts/widget.spec.ts @@ -11,14 +11,14 @@ import {resolve} from 'path'; import ace from 'brace'; -import {OutputArea} from '../../src/ts/areas'; -import * as Strings from '../../src/ts/strings'; +import {OutputArea} from '../../src/ts/areas.ts'; +import * as Strings from '../../src/ts/strings.ts'; -import {widgetFactory} from '../../src/ts/widget'; -import {ServerWorker} from '../../src/ts/server'; -import {CheckOutput, RunProgram} from '../../src/ts/server-types'; +import {widgetFactory} from '../../src/ts/widget.ts'; +import {ServerWorker} from '../../src/ts/server.ts'; +import {CheckOutput, RunProgram} from '../../src/ts/server-types.ts'; import {getElemsByTag, getElemById, getElemsByClass} - from '../../src/ts/dom-utils'; + from '../../src/ts/dom-utils.ts'; global.WebSocket = WebSocket; diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index ef292ae51..b4cdf0a7a 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -1,6 +1,7 @@ { "compilerOptions": { "allowSyntheticDefaultImports": true, + "allowImportingTsExtensions": true, "sourceMap": true, "allowJs": true, "target": "es2022",