vue/valid-v-is
Enforce valid v-is directives.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
error |
essential, happy-path, nuxt, ecosystem, opinionated |
No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
v-is has an argument or modifier, lacks its value, or sits on a component instead of a native HTML element.
<template>
<tr v-is:arg="'MyRow'"></tr>
<tr v-is.mod="'MyRow'"></tr>
<tr v-is></tr>
<MyComponent v-is="'MyRow'" />
</template>
Good
v-is with a value on a native element such as <tr> names the component to render in its place.
<template>
<tr v-is="'MyRow'"></tr>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/valid-v-is": "error"
}
},
});
Then run vp run lint.