vue/no-invalid-html-attribute
Disallow invalid static values for HTML attributes.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
happy-path, nuxt, ecosystem, opinionated |
No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The anchor uses stylesheet as a rel value, although that value belongs to stylesheet link elements.
<template>
<a href="/guide" rel="stylesheet">Guide</a>
</template>
Good
The anchor uses help, a rel value appropriate for a linked help resource.
<template>
<a href="/guide" rel="help">Guide</a>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-invalid-html-attribute": "warn"
}
},
});
Then run vp run lint.