Registry / testing / eslint-plugin-vuejs-accessibility

eslint-plugin-vuejs-accessibility

JSON →
library2.5.0jsnpmunverified

An ESLint plugin for checking accessibility (a11y) rules in Vue.js single-file components (.vue files). Current stable version is 2.5.0 (released 2025-03-28). It provides a set of rules to enforce WCAG and ARIA best practices, inspired by eslint-plugin-jsx-a11y but tailored for Vue templates. Released under MIT license, actively maintained by the vue-a11y community. Supports ESLint v5–v10, ship TypeScript declarations, and works with both legacy (extends) and flat config formats. Key differentiator vs. other Vue a11y tools: it is the most comprehensive and community-maintained plugin.

npm install eslint-plugin-vuejs-accessibility
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-VUEJ
E
eslint-plugin-vuejs-accessibility
testingjavascriptv2.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plugin (default export)
const plugin = require('eslint-plugin-vuejs-accessibility'); // or import plugin from 'eslint-plugin-vuejs-accessibility';
import { rules } from 'eslint-plugin-vuejs-accessibility';
The default export is the plugin object containing rules and configs. Named exports are not available.
Flat config usage (ESM)
import plugin from 'eslint-plugin-vuejs-accessibility'; export default [ plugin.configs['flat/recommended'], { rules: { 'vuejs-accessibility/alt-text': 'error' } } ];
module.exports = { plugins: ['vuejs-accessibility'], extends: ['plugin:vuejs-accessibility/recommended'] };
Flat config is supported since v2.3.0. Legacy .eslintrc format still works. The config key for flat is 'flat/recommended' or 'flat/all'.
Legacy ESLint config (CJS)
module.exports = { extends: ['plugin:vuejs-accessibility/recommended'], rules: { 'vuejs-accessibility/alt-text': 'error' } };
extends: ['eslint-plugin-vuejs-accessibility/recommended']
Use the plugin prefix 'plugin:vuejs-accessibility/' in extends, not the full npm package name.
Custom rule configuration
// .eslintrc { 'vuejs-accessibility/click-events-have-key-events': 'warn' }
"vuejs-accessibility/click-events-have-key-events": "off"
Rules are prefixed with 'vuejs-accessibility/'. Each rule can have severity and options. Refer to docs for individual rule options.

Shows both flat config (ESLint v9+) and legacy .eslintrc setup for eslint-plugin-vuejs-accessibility v2.5.0.

// Install: npm install --save-dev eslint eslint-plugin-vuejs-accessibility // Use with Flat config (ESLint v9+, recommended): // eslint.config.js import plugin from 'eslint-plugin-vuejs-accessibility'; import globals from 'globals'; export default [ { languageOptions: { globals: { ...globals.browser, ...globals.node } } }, plugin.configs['flat/recommended'], { rules: { 'vuejs-accessibility/alt-text': ['error', { elements: ['img', 'area', 'input[type="image"]'] }], 'vuejs-accessibility/click-events-have-key-events': 'warn' } } ]; // For .eslintrc (legacy, ESLint v8): // .eslintrc.js module.exports = { extends: ['plugin:vuejs-accessibility/recommended'], rules: { 'vuejs-accessibility/alt-text': 'error' } };
Debug
Known issues
breakingFlat config support was added in v2.3.0. Prior to v2.3.0, only legacy .eslintrc format worked with ESLint v8. ESLint v9 users must use v2.3.0+ and flat config.
fix
Upgrade to v2.3.0 or later. If using ESLint v9, update config to flat format as shown in quickstart.
affects: <2.3.0
deprecatedThe rule 'label-has-for' is deprecated in favor of 'form-control-has-label'. It will be removed in a future major version.
fix
Replace 'vuejs-accessibility/label-has-for' with 'vuejs-accessibility/form-control-has-label' in your ESLint rules.
affects: >=2.2.0
gotchaPeer dependency 'globals' is required and must be >=13.12.1. Missing 'globals' can cause errors in flat config setups.
fix
Run `npm install --save-dev globals` (or appropriate version). Ensure 'globals' is listed in devDependencies.
affects: >=2.4.2
gotchaWhen using flat config, the config key is 'flat/recommended' (not 'recommended'). Using 'recommended' without 'flat/' will fail.
fix
Use plugin.configs['flat/recommended'] in flat config; for legacy config, use extends: ['plugin:vuejs-accessibility/recommended'].
affects: >=2.3.0
gotchaRules must be prefixed with 'vuejs-accessibility/' in rule settings. Omitting the prefix causes ESLint to throw 'Definition for rule was not found'.
fix
Correct rule name format: 'vuejs-accessibility/rule-name'. Example: 'vuejs-accessibility/alt-text'.
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-vuejs-accessibility".
Missing or incorrect installation of the plugin package.
fix
Run `npm install --save-dev eslint-plugin-vuejs-accessibility` (or yarn equivalent). Ensure the package is in your devDependencies.
Definition for rule 'vuejs-accessibility/alt-text' was not found.
The rule prefix is missing or plugin not loaded correctly. Common mistake: using 'alt-text' instead of 'vuejs-accessibility/alt-text'.
fix
Prefix rule names with 'vuejs-accessibility/'. Example: 'vuejs-accessibility/alt-text': 'error'.
Invalid plugin object, expected a plugin with a 'rules' property.
Using the wrong import style, e.g., `import { rules } from 'eslint-plugin-vuejs-accessibility'` instead of default import.
fix
Import the plugin as default: `import plugin from 'eslint-plugin-vuejs-accessibility';`.
Prop `title` is missing from template, but rule `vuejs-accessibility/alt-text` is enabled.
The rule flags missing alt text on images; sometimes users misunderstand it expects a `title` prop instead of `alt`.
fix
Add an `alt` attribute to your <img> elements: `<img src="..." alt="description">`.
Cannot find module 'globals'
Missing peer dependency 'globals' required since v2.4.2.
fix
Install `globals` as a dev dependency: `npm install --save-dev globals`.
Upgrade
Version history
2.5.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency - ESLint core required to run the plugin
globalsrequiredPeer dependency - provides global variable definitions for linting
Agent activity
2 hits · last 30 days
node
2
Resources