vue/valid-v-cloak
Enforce valid v-cloak 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-cloak is given a value, argument, or modifier even though it accepts none of those.
<template>
<div v-cloak="foo"></div>
<div v-cloak:arg></div>
<div v-cloak.mod></div>
</template>
Good
Use bare v-cloak; CSS can hide the element until Vue removes that attribute after mounting.
<template>
<div v-cloak></div>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/valid-v-cloak": "error"
}
},
});
Then run vp run lint.