{"id":10840,"library":"eslint-plugin-vue-test-utils","title":"ESLint Plugin for Vue Test Utils","description":"The `eslint-plugin-vue-test-utils` package is an ESLint plugin dedicated to enforcing best practices and identifying potential issues when using the `@vue/test-utils` library for testing Vue components. It helps developers maintain high-quality and future-proof test suites by flagging deprecated API usages, inconsistent patterns, and common anti-patterns. The current stable version is 1.0.1, indicating a mature initial release. While a strict release cadence isn't explicitly stated, the recent v1.0.1 release with multiple feature additions and documentation improvements suggests active development. Its core differentiator lies in its specialized focus on `@vue/test-utils`, providing rules that are context-aware of VTU's API changes and version-specific behaviors, often with autofixing capabilities. This enables smoother upgrades of `@vue/test-utils` and helps keep test code consistent without needing manual audits for deprecated features. It complements broader ESLint Vue plugins by offering specific, targeted linting for testing concerns.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/BeProductiv/eslint-plugin-vue-test-utils","tags":["javascript","eslint","eslintplugin","eslint-plugin","@vue/test-utils","vue","test"],"install":[{"cmd":"npm install eslint-plugin-vue-test-utils","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-vue-test-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-vue-test-utils","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for ESLint plugin functionality.","package":"eslint","optional":false}],"imports":[{"note":"ESLint plugins are configured via the `plugins` array in your `.eslintrc` file, not imported in JavaScript code.","wrong":"import vueTestUtilsPlugin from 'eslint-plugin-vue-test-utils'; // Not how ESLint plugins are used\nrequire('eslint-plugin-vue-test-utils'); // Not how ESLint plugins are used directly","symbol":"ESLint plugin configuration","correct":"{\n  \"plugins\": [\"vue-test-utils\"]\n}"},{"note":"When extending a plugin's configuration, the full `plugin:{plugin-name}/{config-name}` syntax is required.","wrong":"\"extends\": [\"vue-test-utils/recommended\"]","symbol":"Recommended configuration","correct":"{\n  \"extends\": [\n    // ...\n    \"plugin:vue-test-utils/recommended\"\n  ]\n}"},{"note":"ESLint rule IDs for plugins must be prefixed with the plugin name (`vue-test-utils/`) followed by the rule ID.","wrong":"{\n  \"rules\": {\n    \"no-deprecated-wrapper-functions\": \"error\"\n  }\n}","symbol":"Individual rule configuration","correct":"{\n  \"rules\": {\n    \"vue-test-utils/no-deprecated-wrapper-functions\": \"error\"\n  }\n}"},{"note":"The setting key for the Vue Test Utils version is specifically `vtu.version` under the `settings` object in `.eslintrc`.","wrong":"{\n  \"settings\": {\n    \"vueTestUtilsVersion\": \"1.3.0\"\n  }\n}","symbol":"Setting Vue Test Utils version","correct":"{\n  \"settings\": {\n    \"vtu\": {\n      \"version\": \"1.3.0\"\n    }\n  }\n}"}],"quickstart":{"code":"npm install --save-dev eslint eslint-plugin-vue-test-utils @vue/test-utils vue\n\n// .eslintrc.js\n// Make sure you have @vue/test-utils installed and configured for your project\nmodule.exports = {\n  root: true,\n  env: {\n    node: true,\n    'vue/setup-compiler-macros': true, // Essential for Vue 3 SFC setup script syntax\n    jest: true // Or 'vitest: true' if using Vitest for tests\n  },\n  parserOptions: {\n    ecmaVersion: 2020,\n    sourceType: 'module'\n  },\n  extends: [\n    'eslint:recommended',\n    'plugin:vue/vue3-recommended', // Example: Use Vue 3 recommended rules\n    'plugin:vue-test-utils/recommended' // Enable all recommended vue-test-utils rules\n  ],\n  plugins: [\n    'vue-test-utils'\n  ],\n  rules: {\n    // Override or add specific vue-test-utils rules\n    'vue-test-utils/no-deprecated-wrapper-functions': 'warn',\n    'vue-test-utils/no-deprecated-mount-options': 'error'\n  },\n  settings: {\n    // Manually specify Vue Test Utils version if auto-detection fails (e.g., in monorepos).\n    // This can be useful for rules that adapt behavior based on the VTU version.\n    // \"vtu\": {\n    //   \"version\": require('@vue/test-utils/package.json').version || \"2.0.0\"\n    // }\n  }\n};\n","lang":"javascript","description":"This quickstart demonstrates how to install the plugin, configure it in an `.eslintrc.js` file to use its recommended rules, and manually specify individual rules. It also shows the option to set the Vue Test Utils version manually, which is crucial for correct linting in certain project setups."},"warnings":[{"fix":"Manually set the Vue Test Utils version in your `.eslintrc` settings: `{\"settings\": {\"vtu\": {\"version\": \"1.3.0\"}}}`. You can dynamically read the version using `require('@vue/test-utils/package.json').version` in a JavaScript `.eslintrc` file.","message":"In monorepo setups or non-standard project structures, `eslint-plugin-vue-test-utils` might fail to auto-detect the `@vue/test-utils` version. This can lead to incorrect linting results for version-specific rules.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your Node.js environment meets the specified requirement. Upgrade Node.js to version 14.x or 16+.","message":"The plugin has a minimum Node.js version requirement (`14.x || >= 16`). Running ESLint with an older Node.js version will result in errors or unexpected behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always address warnings and errors reported by the plugin, especially those related to deprecated features. Consult the `@vue/test-utils` migration guide for major version upgrades.","message":"The plugin's rules help identify deprecated `@vue/test-utils` APIs. Ignoring these warnings can lead to broken tests or unexpected behavior when upgrading `@vue/test-utils` to a newer major version.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev eslint-plugin-vue-test-utils` or `yarn add --dev eslint-plugin-vue-test-utils`. Verify the package is listed in `devDependencies`.","cause":"The plugin package was not installed or is inaccessible to ESLint.","error":"ESLint couldn't find the plugin \"eslint-plugin-vue-test-utils\"."},{"fix":"Check the plugin's documentation for the specific rule (`./docs/rules/index.md` in the package) to understand its accepted options and their formats. Correct your `.eslintrc` rule configuration.","cause":"The options provided for a specific rule are not valid according to the rule's schema.","error":"Configuration for rule \"vue-test-utils/no-deprecated-wrapper-functions\" is invalid:"},{"fix":"Ensure `@vue/test-utils` is correctly installed in your project. If it's installed in a non-standard location (e.g., a hoisted monorepo `node_modules`), adjust the `require` path or provide a static version string.","cause":"This error can occur when using `require('@vue/test-utils/package.json').version` in a `.eslintrc.js` file, but `@vue/test-utils` is not installed or the path to its `package.json` is incorrect.","error":"Cannot read properties of undefined (reading 'version')"}],"ecosystem":"npm"}