vue/require-component-is
Require v-bind:is on <component> elements.
| 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
The dynamic <component> has no is target, so Vue cannot choose a component to render.
<template>
<component />
</template>
Good
:is="currentComponent" supplies the component selection; the binding may change at runtime.
<template>
<component :is="currentComponent" />
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/require-component-is": "error"
}
},
});
Then run vp run lint.