Skip to content

Commit 01a12a0

Browse files
chore: lint for floating promises
Fix missing awaits in the tests. Acknowledge a couple of intentionally missing awaits in src. Needed tsconfig information so I've added the project setting - see https://typescript-eslint.io/blog/parser-options-project-true/#introducing-true
1 parent ef1faa8 commit 01a12a0

File tree

7 files changed

+14
-11
lines changed

7 files changed

+14
-11
lines changed

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ module.exports = [
144144
ecmaVersion: 6,
145145
sourceType: 'module',
146146
warnOnUnsupportedTypeScriptVersion: true,
147+
project: true,
148+
tsconfigRootDir: __dirname,
147149
},
148150
},
149151
settings: {
@@ -239,6 +241,7 @@ module.exports = [
239241

240242
'@typescript-eslint/no-empty-interface': 'error',
241243
'@typescript-eslint/no-explicit-any': 'warn',
244+
'@typescript-eslint/no-floating-promises': 'error',
242245
'@typescript-eslint/no-inferrable-types': 'error',
243246
'@typescript-eslint/no-misused-new': 'error',
244247
'@typescript-eslint/no-namespace': 'error',

src/actions/enter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class EnterAction {
159159
// opening a bubble of some sort. We then need to wait for the bubble to
160160
// appear before attempting to navigate into it.
161161
curNode.onClick();
162-
renderManagement.finishQueuedRenders().then(() => {
162+
void renderManagement.finishQueuedRenders().then(() => {
163163
cursor?.in();
164164
});
165165
return true;

src/actions/exit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class ExitAction {
5353
icon.getBubble()?.getWorkspace() === workspace,
5454
);
5555
if (parent) {
56-
parent.setBubbleVisible(false);
56+
void parent.setBubbleVisible(false);
5757
getFocusManager().focusNode(parent);
5858
return true;
5959
}

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
@@ -418,10 +418,10 @@ export async function tabNavigateToWorkspace(
418418
hasFlyout = true,
419419
) {
420420
// Navigate past the initial pre-injection focusable div element.
421-
tabNavigateForward(browser);
422-
if (hasToolbox) tabNavigateForward(browser);
423-
if (hasFlyout) tabNavigateForward(browser);
424-
tabNavigateForward(browser); // Tab to the workspace itself.
421+
await tabNavigateForward(browser);
422+
if (hasToolbox) await tabNavigateForward(browser);
423+
if (hasFlyout) await tabNavigateForward(browser);
424+
await tabNavigateForward(browser); // Tab to the workspace itself.
425425
}
426426

427427
/**

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
// NOTE: `test/**/*` is automatically included in `blockly-scripts start`.
1414
// Only src matters for production builds.
1515
"include": ["./src", "./test"],
16-
"exclude": ["./test/webdriverio/"]
16+
"exclude": ["./test/webdriverio/test"]
1717
}

0 commit comments

Comments
 (0)