### Install eslint-plugin-vuejs-accessibility with Yarn, npm, or pnpm Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/index.md Installs the eslint-plugin-vuejs-accessibility package as a development dependency using different package managers. This plugin helps enforce accessibility standards in Vue.js projects. ```bash yarn add --dev eslint-plugin-vuejs-accessibility ``` ```bash npm install --save-dev eslint-plugin-vuejs-accessibility ``` ```bash pnpm add -D eslint-plugin-vuejs-accessibility ``` -------------------------------- ### Configure ESLint with Legacy Config (.eslintrc) Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/index.md Configures ESLint using legacy configuration files (.eslintrc.*) for versions prior to ESLint v9. It adds the plugin to the 'plugins' section and specifies rules or extends recommended configurations. ```json { "plugins": ["vuejs-accessibility"] } ``` ```json { "rules": { "vuejs-accessibility/rule-name": "error" } } ``` ```json { "extends": ["plugin:vuejs-accessibility/recommended"] } ``` -------------------------------- ### Vue Component Setup with TypeScript Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/rule-overview/index.md This snippet demonstrates the setup of a Vue 3 Single File Component (SFC) using the ` ``` -------------------------------- ### Vue Template Examples for heading-has-content Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/rules/heading-has-content.md These Vue.js template examples demonstrate valid and invalid usage of the 'heading-has-content' rule. The 'Succeed' examples show headings with content, including those using v-html and custom directives/components. The 'Fail' examples illustrate empty headings. ```vue ``` ```vue ``` -------------------------------- ### Configure ESLint with Flat Config (eslint.config.js) Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/index.md Configures ESLint using the flat configuration file format (eslint.config.js), which is the default in ESLint v9 and available from v8.57.0. It imports the plugin and enables its recommended rules, allowing for custom rule overrides. ```javascript import pluginVueA11y from "eslint-plugin-vuejs-accessibility"; export default [ // add more generic rulesets here, such as: // js.configs.recommended, ...pluginVueA11y.configs["flat/recommended"], { rules: { // override/add rules settings here, such as: // "vuejs-accessibility/alt-text": "error" } } ]; ``` -------------------------------- ### Vue.js: Examples of elements with valid alt-text Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/rules/alt-text.md Provides examples of Vue.js template code demonstrating correct usage of alternative text for various elements. This includes images, objects, areas, and input type image elements, showcasing different valid methods for providing accessibility information. ```vue ``` -------------------------------- ### Vue Template Examples for anchor-has-content Rule (Fail) Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/rules/anchor-has-content.md These Vue template examples illustrate invalid usage of the 'anchor-has-content' rule, where anchors lack accessible content. This includes empty anchors or anchors with hidden content. ```vue ``` -------------------------------- ### Vue Template Examples for anchor-has-content Rule (Succeed) Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/rules/anchor-has-content.md These Vue template examples demonstrate valid usage of the 'anchor-has-content' rule. They show anchors with direct text content, content from child components, and content provided via directives. ```vue ``` -------------------------------- ### Succeeding iframe-has-title Examples (Vue) Source: https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/main/docs/rules/iframe-has-title.md These Vue.js code examples demonstrate the correct usage of the iframe-has-title rule. An iframe is considered to succeed if it has a non-empty 'title' attribute, either statically defined or dynamically bound to a variable. ```vue