valid-v-for
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: warnhtml/eslint-plugin-vue-recommended
What it does
Section titled “What it does”Reports a v-for whose value is not item in items (or of), or that has an argument or a modifier. A missing :key is v-for-key.
Why it matters
Section titled “Why it matters”A v-for that does not parse is a compile error, or it loops over nothing.
To fix, write v-for="item in items".
Example
Section titled “Example”<template>... <b v-for="xs" :key="1" :a="" :a.x="1" #a.m v-if:a="1" @click />... <p v-if="ok" :a>...<template>... <b v-for="xs" :key="1" :a="" :a.x="1" #a.m v-if:a="1" @click />... <p v-if="ok" :a>...Configuration
Section titled “Configuration”angular: lint: rules: valid-v-for: warn # off, warn (default), errorhtml: lint: rules: valid-v-for: warn # off, warn (default), errorsvelte: lint: rules: valid-v-for: warn # off, warn (default), errorvue: lint: rules: valid-v-for: warn # off, warn (default), errorEnabled by the presets: html/eslint-plugin-vue-recommended.
Suppress one line with sudsy-disable-next-line valid-v-for in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint-plugin-vue | valid-v-for |
full |