Skip to content

Commit 4944785

Browse files
chore: lint for floating/misused promises
Fix missing awaits in the tests. Needed tsconfig information so I've added the project setting - see https://typescript-eslint.io/blog/parser-options-project-true/#introducing-true I've done this just for the tests as otherwise we hit issues with the test app and the webdriver test app not being covered by tsconfig.json files. It could be trivially extended to the src tree.
1 parent 4f7c61f commit 4944785

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

eslint.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ module.exports = [
239239

240240
'@typescript-eslint/no-empty-interface': 'error',
241241
'@typescript-eslint/no-explicit-any': 'warn',
242-
'@typescript-eslint/no-inferrable-types': 'error',
243242
'@typescript-eslint/no-misused-new': 'error',
244243
'@typescript-eslint/no-namespace': 'error',
245244
'@typescript-eslint/no-non-null-assertion': 'warn',
@@ -259,4 +258,17 @@ module.exports = [
259258
'@typescript-eslint/no-require-imports': 'error',
260259
},
261260
},
261+
{
262+
files: ['test/webdriverio/test/*.ts'],
263+
languageOptions: {
264+
parserOptions: {
265+
project: true,
266+
tsconfigRootDir: __dirname,
267+
},
268+
},
269+
rules: {
270+
'@typescript-eslint/no-floating-promises': 'error',
271+
'@typescript-eslint/no-misused-promises': 'error',
272+
},
273+
},
262274
];

test/webdriverio/test/keyboard_mode_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ suite(
8686

8787
chai.assert.isFalse(await isKeyboardNavigating(this.browser));
8888

89-
this.browser.execute(() => {
89+
await this.browser.execute(() => {
9090
Blockly.keyboardNavigationController.setIsActive(true);
9191
});
9292

@@ -106,7 +106,7 @@ suite(
106106

107107
chai.assert.isFalse(await isKeyboardNavigating(this.browser));
108108

109-
this.browser.execute(() => {
109+
await this.browser.execute(() => {
110110
Blockly.keyboardNavigationController.setIsActive(true);
111111
});
112112

@@ -126,7 +126,7 @@ suite(
126126

127127
await this.browser.pause(PAUSE_TIME);
128128
// Right click a block
129-
clickBlock(this.browser, 'controls_if_1', {button: 'right'});
129+
await clickBlock(this.browser, 'controls_if_1', {button: 'right'});
130130
await this.browser.pause(PAUSE_TIME);
131131

132132
chai.assert.isFalse(await isKeyboardNavigating(this.browser));

test/webdriverio/test/scroll_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ suite('Scrolling into view', function () {
2424
setup(async function () {
2525
this.browser = await testSetup(testFileLocations.BASE);
2626
// Predictable small window size for scrolling.
27-
this.browser.setWindowSize(800, 600);
27+
await this.browser.setWindowSize(800, 600);
2828
await this.browser.pause(PAUSE_TIME);
2929
});
3030

test/webdriverio/test/test_setup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ export async function tabNavigateToWorkspace(
441441
hasFlyout = true,
442442
) {
443443
// Navigate past the initial pre-injection focusable div element.
444-
tabNavigateForward(browser);
445-
if (hasToolbox) tabNavigateForward(browser);
446-
if (hasFlyout) tabNavigateForward(browser);
447-
tabNavigateForward(browser); // Tab to the workspace itself.
444+
await tabNavigateForward(browser);
445+
if (hasToolbox) await tabNavigateForward(browser);
446+
if (hasFlyout) await tabNavigateForward(browser);
447+
await tabNavigateForward(browser); // Tab to the workspace itself.
448448
}
449449

450450
/**

test/webdriverio/test/workspace_comment_test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import * as chai from 'chai';
88
import * as Blockly from 'blockly';
99
import {
10-
contextMenuExists,
1110
focusOnBlock,
1211
getCurrentFocusNodeId,
1312
getFocusedBlockType,

0 commit comments

Comments
 (0)