A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/maranran/eslint-plugin-vue-a11y below:

maranran/eslint-plugin-vue-a11y: Static AST checker for accessibility rules on elements in .vue

Static AST checker for accessibility rules on elements in .vue.

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-vue-a11y:

$ npm install eslint-plugin-vue-a11y --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-vue-a11y globally.

Add vue-a11y to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "vue-a11y"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "vue-a11y/rule-name": 2
    }
}

also You can enable all the base rules at once. Add plugin:vue-a11y/base in extends:

{
  "extends": [
    "plugin:vue-a11y/base"
  ]
}
recommended Supported Rules What is the "Use the latest vue-eslint-parser" error?

The most rules of eslint-plugin-vue-a11y require vue-eslint-parser to check <template> ASTs.

Make sure you have one of the following settings in your .eslintrc:

If you already use other parser (e.g. "parser": "babel-eslint"), please move it into parserOptions, so it doesn't collide with the vue-eslint-parser used by this plugin's configuration:

- "parser": "babel-eslint",
  "parserOptions": {
+     "parser": "babel-eslint",
      "ecmaVersion": 2018,
      "sourceType": "module"
  }
Why doesn't it work on .vue file?
  1. Make sure you don't have eslint-plugin-html in your config. The eslint-plugin-html extracts the content from <script> tags, but eslint-vue-plugin requires <script> tags and <template> tags in order to distinguish template and script in single file components.
  "plugins": [
    "vue",
-   "html"
  ]
eslint-disable functionality in <template> ?
  1. Make sure you have used eslint-plugin-vue and you can use like HTML comments in of .vue files. For example:
    <template>
      <!-- eslint-disable-next-line vue-a11y/anchor-has-content -->
      <a></a>
      <h1></h1>  <!-- eslint-disable-line -->
    </template>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4