Skip to content

alexandreL/eslint-plugin-vue-require-id

Repository files navigation

@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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published