vue/no-restricted-static-attribute
disallow specific attribute.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
None | No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The button has the forbidden data-legacy attribute.
<template>
<button type="button" data-legacy="x">x</button>
</template>
Good
The button keeps only type.
<template>
<button type="button">x</button>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-restricted-static-attribute": "warn"
},
"ruleOptions": {
"vue/no-restricted-static-attribute": [
"data-legacy"
]
}
},
});
Then run vp run lint.