eslint-plugin-wdio

raw JSON →
9.27.0 verified Sat Apr 25 auth: no javascript

An ESLint plugin providing WebdriverIO-specific lint rules to catch common mistakes like missing await on expect calls, debug statements left in code, and floating promises. Version 9.27.0, part of the WebdriverIO v9 monorepo, follows ESLint v9 flat config spec. Ships TypeScript types. Key differentiator: integrates with @typescript-eslint to replace generic await-expect rule with no-floating-promise for type-aware checking. Requires ESLint ^9.39.2, globals ^16.5.0, and typescript-eslint ^8.54.0 as peer dependencies. Release cadence: active, multiple minor releases per month.

error Error: Failed to load plugin 'wdio' declared in 'plugins': Cannot find module 'eslint-plugin-wdio'
cause eslint-plugin-wdio is not installed or not in node_modules.
fix
Run 'npm install eslint-plugin-wdio --save-dev'.
error TypeError: configs is not iterable
cause Importing configs object directly without accessing the correct key, or using CommonJS require() on an ESM-only export.
fix
Use: import { configs } from 'eslint-plugin-wdio'; export default [ configs['flat/recommended'] ];
error Configuration for rule 'wdio/await-expect' is invalid: has no 'meta' property
cause Trying to use the old .eslintrc extends syntax with a flat config file.
fix
Switch to flat config format: export default [ ... ] and use configs['flat/recommended'].
breaking ESLint v9 flat config is required starting from eslint-plugin-wdio v9. Legacy .eslintrc format is not supported.
fix Migrate to flat config: use eslint.config.mjs and import { configs } from 'eslint-plugin-wdio' to get the recommended config.
deprecated The 'wdio/await-expect' rule is deprecated in favor of 'wdio/no-floating-promise' when using TypeScript with @typescript-eslint.
fix Install typescript-eslint and use 'wdio/no-floating-promise' instead; the recommended config auto-switches if typescript-eslint is detected.
gotcha CommonJS require() may not load the plugin correctly with flat config. Use ES module import.
fix Set 'type': 'module' in package.json or use .mjs extension for config file and use import syntax.
gotcha The plugin peer dependency on globals ^16.5.0 must be satisfied; otherwise ESLint may fail to resolve globals.
fix Run 'npm install globals@^16.5.0 --save-dev'.
gotcha If using TypeScript, the recommended config automatically replaces 'wdio/await-expect' with 'wdio/no-floating-promise', but this requires @typescript-eslint/eslint-plugin and typescript installed.
fix Install 'typescript' and '@typescript-eslint/eslint-plugin' as dev dependencies.
npm install eslint-plugin-wdio
yarn add eslint-plugin-wdio
pnpm add eslint-plugin-wdio

Shows how to configure eslint-plugin-wdio with ESLint v9 flat config, enabling recommended rules and customizing no-pause/no-debug.

// eslint.config.mjs
import { configs as wdioConfig } from 'eslint-plugin-wdio';
import js from '@eslint/js';

export default [
  js.configs.recommended,
  wdioConfig['flat/recommended'],
  {
    rules: {
      'wdio/no-pause': 'warn',
      'wdio/no-debug': 'error',
    }
  }
];