Skip to content

feat: Use no floating promise eslint rule for missing await#15084

Merged
christian-bromann merged 5 commits intowebdriverio:mainfrom
dprevost-LMI:add-no-floating-promise-eslint-rule
Mar 7, 2026
Merged

feat: Use no floating promise eslint rule for missing await#15084
christian-bromann merged 5 commits intowebdriverio:mainfrom
dprevost-LMI:add-no-floating-promise-eslint-rule

Conversation

@dprevost-LMI
Copy link
Copy Markdown
Contributor

@dprevost-LMI dprevost-LMI commented Feb 4, 2026

Proposed changes

Because WDIO tests rely heavily on await, and also since typings in expect-webdriverio are now fixed, then TypeScript projects should enforce an ESLint rule that prevents “floating” Promises (i.e., Promises that aren’t awaited).

We’ve already enabled this rule in our codebase, and it has helped developers and QA catch flaky tests caused by missing await.

  • Added new rule no-floating-promise coming from the typescript rule
  • Enable a ts-recommend config only for ts projects, else fallback on js-recommended as before
  • Fix legacy eslint lefover
  • Fix e2e/browser-runner/components/LitComponent.ts failing ESLint by adding some missing globals in the ESLint config for e2e folders
  • Support more matchers for the JS await rule, like snapshot when passing $ or $$

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Breaking change

For a TypeScript project this could be seen as a breaking behavior changes

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

//: # (The current main branch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against the v8 branch.)

  • This change is solely for v9 and doesn't need to be back-ported

Further comments

Testing

  • Tested in a Typescript project here
  • Tested in a plain JavaScript project here
image

Reviewers: @webdriverio/project-committers

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 5, 2026

Open in StackBlitz

create-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/create-wdio@15084

eslint-plugin-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/eslint-plugin-wdio@15084

@wdio/allure-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/allure-reporter@15084

@wdio/appium-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/appium-service@15084

@wdio/browser-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browser-runner@15084

@wdio/browserstack-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browserstack-service@15084

@wdio/cli

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cli@15084

@wdio/concise-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/concise-reporter@15084

@wdio/config

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/config@15084

@wdio/cucumber-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cucumber-framework@15084

@wdio/dot-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/dot-reporter@15084

@wdio/firefox-profile-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/firefox-profile-service@15084

@wdio/globals

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/globals@15084

@wdio/jasmine-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/jasmine-framework@15084

@wdio/json-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/json-reporter@15084

@wdio/junit-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/junit-reporter@15084

@wdio/lighthouse-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/lighthouse-service@15084

@wdio/local-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/local-runner@15084

@wdio/logger

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/logger@15084

@wdio/mocha-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/mocha-framework@15084

@wdio/protocols

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/protocols@15084

@wdio/repl

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/repl@15084

@wdio/reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/reporter@15084

@wdio/runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/runner@15084

@wdio/sauce-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sauce-service@15084

@wdio/shared-store-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/shared-store-service@15084

@wdio/smoke-test-cjs-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-cjs-service@15084

@wdio/smoke-test-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-reporter@15084

@wdio/smoke-test-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-service@15084

@wdio/spec-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/spec-reporter@15084

@wdio/static-server-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/static-server-service@15084

@wdio/sumologic-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sumologic-reporter@15084

@wdio/testingbot-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/testingbot-service@15084

@wdio/types

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/types@15084

@wdio/utils

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/utils@15084

@wdio/webdriver-mock-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/webdriver-mock-service@15084

@wdio/xvfb

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/xvfb@15084

webdriver

npm i https://pkg.pr.new/webdriverio/webdriverio/webdriver@15084

webdriverio

npm i https://pkg.pr.new/webdriverio/webdriverio@15084

commit: afa2550

@dprevost-LMI dprevost-LMI marked this pull request as ready for review February 5, 2026 01:57
Copy link
Copy Markdown
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice, thank you!

@christian-bromann christian-bromann force-pushed the add-no-floating-promise-eslint-rule branch from afa2550 to 025c961 Compare March 7, 2026 22:34
Add rule so most of the missing await for promises are trapped

replace `wdio/await-expect` by `wdio/no-floating-promise` when possible

Working version

clear js vs ts config
@christian-bromann christian-bromann force-pushed the add-no-floating-promise-eslint-rule branch from 025c961 to 4d80d43 Compare March 7, 2026 22:35
@christian-bromann christian-bromann added the PR: New Feature 🚀 PRs that contain new features label Mar 7, 2026
@christian-bromann christian-bromann merged commit 9a683ff into webdriverio:main Mar 7, 2026
9 checks passed
@wdio-bot
Copy link
Copy Markdown
Contributor

wdio-bot commented Mar 7, 2026

Hey dprevost-LMI 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution.

We've sent you an email with further instructions on how to claim your expenses from our development fund.
Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at [email protected] or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Expensable $50 💸 PR: New Feature 🚀 PRs that contain new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants