vue/no-v-text
Disallow the v-text directive; prefer mustache interpolation.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
nuxt, opinionated |
No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The div's content is supplied through the v-text directive.
<template>
<div v-text="message"></div>
</template>
Good
Mustache interpolation expresses the same text binding directly in the element content.
<template>
<div>{{ message }}</div>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-v-text": "warn"
}
},
});
Then run vp run lint.