Eslint rules for WebdriverIO
npm install eslint-plugin-wdioESLint rules for WebdriverIO
You'll first need to install ESLint:
``sh`
npm i eslint --save-dev
Next, install eslint-plugin-wdio:
`sh`
npm install eslint-plugin-wdio --save-dev
Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-wdio globally.
This plugin export a recommended configuration that enforce good practices.
To enable this configuration use the extends property in your .eslintrc config file:
`json`
{
"plugins": ["wdio"],
"extends": [
"eslint:recommended",
"plugin:wdio/recommended"
]
}
If you are using the latest version of Eslint with the flat configuration, you can embed this plugin as follows:
`js
// eslint.config.mjs
import { configs as wdioConfig } from "eslint-plugin-wdio";
export default [
{
extends: [
wdioConfig['flat/recommended'],
// ...
]
}
];
`
See ESLint documentation for more information about extending configuration files.
expect calls must be prefixed with an await
Don't allow browser.debug() statements
Don't allow browser.pause(