eslint-plugin-wdio
v9.27.0
Published
Eslint rules for WebdriverIO
Readme
eslint-plugin-wdio
ESLint rules for WebdriverIO
Installation
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-wdio:
npm install eslint-plugin-wdio --save-devNote: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-wdio globally.
Recommended configuration
This plugin exports a recommended configuration that enforces good practices.
With ESLint v8 and below
To enable this configuration use the extends property in your .eslintrc config file:
{
"plugins": ["wdio"],
"extends": [
"eslint:recommended",
"plugin:wdio/recommended"
]
}With ESLint v9 and Flat Config
If you are using the latest version of ESLint with the flat configuration, you can embed this plugin as follows:
// eslint.config.mjs
import { configs as wdioConfig } from "eslint-plugin-wdio";
export default [
wdioConfig['flat/recommended'],
];See ESLint documentation for more information about extending configuration files.
TypeScript Support
When typescript and @typescript-eslint/eslint-plugin are detected, the recommended configuration automatically replaces wdio/await-expect with wdio/no-floating-promise for stricter, type-aware promise handling.
To enable this, install the required dependencies:
npm install --save-dev typescript @typescript-eslint/eslint-pluginList of supported rules
expect calls must be prefixed with an await
Don't allow browser.debug() statements
Don't allow browser.pause(<number>) statements
Check for unhandled promises
