Skip to content

Commit e764e36

Browse files
committed
oxlint: Fix type related issues, configure oxc vscode extension correctly
1 parent beaaf9d commit e764e36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+242
-203
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"editor.guides.bracketPairs": true,
44
"editor.formatOnSave": false,
55
"workbench.editor.revealIfOpen": true,
6+
"oxc.enable.oxlint": true,
7+
"oxc.typeAware": true,
68
"[javascript]": {
79
"editor.formatOnSave": true,
810
},

package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"esbuild": "~0.27.3",
2424
"minimatch": "~10.2.4",
2525
"oxlint": "~1.51.0",
26-
"oxlint-tsgolint": "~0.15.0",
26+
"oxlint-tsgolint": "~0.16.0",
2727
"shx": "~0.4.0",
2828
"tsx": "~4.21.0",
2929
"typescript": "~5.9.3",
@@ -43,8 +43,8 @@
4343
"watch": "tsgo --build tsconfig.build.json --watch --verbose",
4444
"watch:tsc": "tsc --build tsconfig.build.json --watch --verbose",
4545
"build:tsc": "tsc --build tsconfig.build.json --verbose",
46-
"lint": "oxlint",
47-
"lint:typeaware": "oxlint --type-aware",
46+
"lint": "oxlint --type-aware",
47+
"lint:notypese": "oxlint",
4848
"production:build": "npm run production:build --workspace packages/examples",
4949
"production:preview:build": "npm run production:preview:build --workspace packages/examples",
5050
"production:preview": "npm run production:preview --workspace packages/examples",

packages/client/src/editorApp/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface EditorAppConfig {
5858
languageExtensionConfig: monaco.languages.ILanguageExtensionPoint;
5959
monarchLanguage?: monaco.languages.IMonarchLanguage;
6060
theme?: {
61-
name: monaco.editor.BuiltinTheme | string;
61+
name: string;
6262
data: monaco.editor.IStandaloneThemeData;
6363
}
6464
}

packages/client/src/editorApp/editorApp.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ export class EditorApp {
4646
constructor(userAppConfig?: EditorAppConfig) {
4747
this.id = userAppConfig?.id ?? Math.floor(Math.random() * 1000001).toString();
4848
if ((userAppConfig?.useDiffEditor ?? false) && !userAppConfig?.codeResources?.original) {
49-
throw new Error(`Use diff editor was used without a valid config. code: ${userAppConfig?.codeResources?.modified} codeOriginal: ${userAppConfig?.codeResources?.original}`);
49+
const modifiedString = JSON.stringify(userAppConfig?.codeResources?.modified);
50+
const originalString = JSON.stringify(userAppConfig?.codeResources?.original);
51+
throw new Error(`Use diff editor was used without a valid config. code: ${modifiedString} codeOriginal: ${originalString}`);
5052
}
5153
this.config = {
5254
codeResources: userAppConfig?.codeResources ?? undefined,
@@ -165,7 +167,7 @@ export class EditorApp {
165167
}
166168

167169
if (this.config.editorOptions?.['semanticHighlighting.enabled'] !== undefined) {
168-
StandaloneServices.get(IConfigurationService).updateValue('editor.semanticHighlighting.enabled',
170+
await StandaloneServices.get(IConfigurationService).updateValue('editor.semanticHighlighting.enabled',
169171
this.config.editorOptions['semanticHighlighting.enabled'], ConfigurationTarget.USER);
170172
}
171173

packages/client/src/wrapper/lcwrapper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ export class LanguageClientWrapper {
6060

6161
if (conOptions.$type === 'WebSocketDirect' || conOptions.$type === 'WebSocketParams' || conOptions.$type === 'WebSocketUrl') {
6262
const webSocket = conOptions.$type === 'WebSocketDirect' ? conOptions.webSocket : new WebSocket(createUrl(conOptions));
63-
this.initMessageTransportWebSocket(webSocket, resolve, reject);
63+
return this.initMessageTransportWebSocket(webSocket, resolve, reject);
6464
} else {
6565
// init of worker and start of languageclient can be handled directly, because worker available already
66-
this.initMessageTransportWorker(conOptions, resolve, reject);
66+
return this.initMessageTransportWorker(conOptions, resolve, reject);
6767
}
6868
});
6969
}

packages/client/test/editorApp/editorApp-classic.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Test Test EditorApp (classic)', () => {
9595
});
9696

9797
const editorApp = new EditorApp(editorAppConfig);
98-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
98+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
9999

100100
expect(editorApp).toBeDefined();
101101

@@ -114,7 +114,7 @@ describe('Test Test EditorApp (classic)', () => {
114114
});
115115
const editorApp = new EditorApp(editorAppConfig);
116116

117-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
117+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
118118

119119
const modelRefs = editorApp['modelRefs'];
120120
expect(modelRefs?.modified).toBeDefined();
@@ -132,7 +132,7 @@ describe('Test Test EditorApp (classic)', () => {
132132
});
133133

134134
const editorApp = new EditorApp(editorAppConfig);
135-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
135+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
136136
await expect(async () => {
137137
await editorApp.start(htmlContainer);
138138
}).rejects.toThrowError('Start was called without properly disposing the EditorApp first.');
@@ -149,9 +149,9 @@ describe('Test Test EditorApp (classic)', () => {
149149
});
150150
const editorApp = new EditorApp(editorAppConfig);
151151

152-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
152+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
153153
await editorApp.dispose();
154-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
154+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
155155

156156
await editorApp.dispose();
157157
});
@@ -172,7 +172,7 @@ describe('Test Test EditorApp (classic)', () => {
172172

173173
const editorApp = new EditorApp(editorAppConfig);
174174

175-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
175+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
176176

177177
const modelRefs = editorApp['modelRefs'];
178178
expect(modelRefs?.modified).toBeDefined();
@@ -196,7 +196,7 @@ describe('Test Test EditorApp (classic)', () => {
196196
};
197197
const editorApp = new EditorApp(editorAppConfig);
198198

199-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
199+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
200200

201201
const modelRefs = editorApp['modelRefs'];
202202
expect(modelRefs?.modified).toBeDefined();
@@ -218,7 +218,7 @@ describe('Test Test EditorApp (classic)', () => {
218218
};
219219
const editorApp = new EditorApp(editorAppConfig);
220220

221-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
221+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
222222

223223
const modelRefs = editorApp['modelRefs'];
224224
expect(modelRefs?.modified).toBeDefined();
@@ -243,7 +243,7 @@ describe('Test Test EditorApp (classic)', () => {
243243
});
244244
editorAppConfig.codeResources = {};
245245
const editorApp = new EditorApp(editorAppConfig);
246-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
246+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
247247

248248
const modelRefs = editorApp['modelRefs'];
249249
// default modelRef is created with regular editor even if no codeResources are given
@@ -263,11 +263,11 @@ describe('Test Test EditorApp (classic)', () => {
263263
editorAppConfig.codeResources = {};
264264
const editorApp = new EditorApp(editorAppConfig);
265265

266-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
266+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
267267

268268
editorApp.setModelRefDisposeTimeout(1000);
269269

270-
editorApp.updateCodeResources({
270+
await editorApp.updateCodeResources({
271271
modified: {
272272
text: 'const text = "Hello World!";',
273273
uri: '/workspace/statemachineUri.statemachine'
@@ -294,14 +294,14 @@ describe('Test Test EditorApp (classic)', () => {
294294
expect(modelRefsBefore?.modified).toBeUndefined();
295295
expect(modelRefsBefore?.original).toBeUndefined();
296296

297-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
297+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
298298

299299
editorApp.registerOnTextChangedCallback((textChanges: TextContents) => {
300300
console.log(textChanges);
301301
expect(textChanges.modified).toEqual('// comment');
302302
});
303303

304-
await expect(await editorApp.updateCodeResources({
304+
expect(await editorApp.updateCodeResources({
305305
modified: {
306306
text: '// comment',
307307
uri: '/workspace/test.statemachine',
@@ -323,7 +323,7 @@ describe('Test Test EditorApp (classic)', () => {
323323
}
324324
});
325325
const editorApp = new EditorApp(editorAppConfig);
326-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
326+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
327327

328328
const currentModel = editorApp.getEditor()?.getModel();
329329
expect(monaco.editor.getModels().includes(currentModel!)).toBeTruthy();
@@ -342,7 +342,7 @@ describe('Test Test EditorApp (classic)', () => {
342342
});
343343
const editorApp = new EditorApp(editorAppConfig);
344344

345-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
345+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
346346

347347
const currentModel = editorApp.getEditor()?.getModel();
348348
expect(monaco.editor.getModels().includes(currentModel!)).toBeTruthy();

packages/client/test/editorApp/editorApp.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ describe('Test EditorApp', () => {
9090
test('Start EditorApp', async () => {
9191
const editorAppConfig = createEditorAppConfig({});
9292
const editorApp = new EditorApp(editorAppConfig);
93-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
94-
await editorApp.dispose();
93+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
94+
expect(await editorApp.dispose()).toBeUndefined();
9595
});
9696

9797
test('Update code resources after start (same file)', async () => {
@@ -103,7 +103,7 @@ describe('Test EditorApp', () => {
103103
});
104104
const editorApp = new EditorApp(editorAppConfig);
105105

106-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
106+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
107107
expect(editorApp.isStarted()).toBeTruthy();
108108

109109
editorApp.registerOnTextChangedCallback((textChanges: TextContents) => {
@@ -136,12 +136,12 @@ describe('Test EditorApp', () => {
136136
});
137137
const editorApp = new EditorApp(editorAppConfig);
138138

139-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
139+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
140140
expect(editorApp.isStarted()).toBeTruthy();
141141

142142
editorApp.setModelRefDisposeTimeout(1000);
143143

144-
await expect(await editorApp.updateCodeResources({
144+
expect(await editorApp.updateCodeResources({
145145
modified: {
146146
text: codeUpdated,
147147
uri: `/workspace/${expect.getState().testPath}_2.js`,
@@ -172,7 +172,7 @@ describe('Test EditorApp', () => {
172172
// oxlint-disable-next-line @typescript-eslint/no-explicit-any
173173
const spyAnnounceModelUpdate = vi.spyOn(editorApp as any, 'announceModelUpdate');
174174

175-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
175+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
176176

177177
onTextChangedDiposeable = editorApp['textChangedDisposables'].modified;
178178
expect(onTextChangedDiposeable).toBeDefined();
@@ -206,11 +206,11 @@ describe('Test EditorApp', () => {
206206
});
207207
let editorApp = new EditorApp(editorAppConfig);
208208

209-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
209+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
210210
expect(editorApp.isStarting()).toBeFalsy();
211211
expect(editorApp.isDisposing()).toBeFalsy();
212212

213-
await expect(await editorApp.dispose()).toBeUndefined();
213+
expect(await editorApp.dispose()).toBeUndefined();
214214

215215
expect(editorApp.isStarting()).toBeFalsy();
216216
expect(editorApp.isDisposing()).toBeFalsy();
@@ -222,7 +222,7 @@ describe('Test EditorApp', () => {
222222
}
223223
});
224224
editorApp = new EditorApp(editorAppConfig);
225-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
225+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
226226

227227
await editorApp.dispose();
228228
});
@@ -236,7 +236,7 @@ describe('Test EditorApp', () => {
236236
});
237237
const editorApp = new EditorApp(editorAppConfig);
238238

239-
await expect(await editorApp.start(htmlContainer)).toBeUndefined();
239+
expect(await editorApp.start(htmlContainer)).toBeUndefined();
240240

241241
await editorApp.dispose();
242242
});

packages/client/test/vscode/manager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('MonacoVscodeApiWrapper Tests', () => {
5757
expect(envEnhanced.vscodeApiInitialised).toBeFalsy();
5858

5959
// wait for the initial promise to complete and expect that api init was completed and is no longer ongoing
60-
await expect(await promise).toBeUndefined();
60+
expect(await promise).toBeUndefined();
6161
envEnhanced = getEnhancedMonacoEnvironment();
6262
expect(envEnhanced.vscodeApiGlobalInitAwait).toBeUndefined();
6363
expect(envEnhanced.vscodeApiGlobalInitResolve).toBeUndefined();

0 commit comments

Comments
 (0)