vue/valid-v-memo
Enforce valid v-memo 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
Bare v-memo gives Vue no dependency expression for deciding when to reuse the subtree.
<template>
<div v-memo></div>
</template>
Good
v-memo="[valueA, valueB]" supplies the dependency array used for memoization.
<template>
<div v-memo="[valueA, valueB]">{{ label }}</div>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/valid-v-memo": "error"
}
},
});
Then run vp run lint.