@vue-require-id/eslint-plugin
v1.0.4
Published
@vue-require-id/eslint-plugin is a custom ESLint plugin that enforces the use of 'id' attribute on specified HTML elements in Vue.js templates.
Downloads
12
Readme
@vue-require-id/eslint-plugin
A custom ESLint plugin that enforces adding an id attribute to all specified elements in Vue.js templates using the vue-eslint-parser. This plugin can be used to catch missing id attributes during development and ensure accessibility best practices are being followed.
Usage
To use this plugin, add it to your ESLint configuration file and enable the @vue-require-id/require-id
rule with an options object that lists the elements to check for the presence of the id attribute.
For example:
{
"plugins": [
"vue-require-id"
],
"rules": {
"@vue-require-id/require-id": [
"error",
{
"elements": [
"input",
"button"
]
}
]
}
}
If the id attribute is missing from any input or button element in your templates, ESLint will report an error.
test
install test packages:
"mocha": "^10.2.0", "eslint-plugin-vue": "^9.13.0"
run test:
npm run test
License This project is licensed under the MIT License.