Skip to content

valid-v-bind

Reports a v-bind that has no expression (:name alone is the shorthand for :name="name", a bare v-bind is not) or a modifier other than camel, prop, attr and sync.

A binding with no value, or with a modifier Vue does not know, is ignored or fails to compile, and the attribute is missing from the element.

To fix, give the binding an expression and use the modifiers of the list.

Reported
<template>
<div v-if v-bind v-model v-html v-text v-show v-once="x" v-pre="x" v-cloak="x" v-memo v-is />
<b v-for="xs" :key="1" :a="" :a.x="1" #a.m v-if:a="1" @click />
...
<p v-if="ok" :a>
...
After the fix
<template>
<div v-if v-bind v-model v-html v-text v-show v-once="x" v-pre="x" v-cloak="x" v-memo v-is />
<b v-for="xs" :key="1" :a="" :a.x="1" #a.m v-if:a="1" @click />
...
<p v-if="ok" :a>
...
angular:
lint:
rules:
valid-v-bind: warn # off, warn (default), error
html:
lint:
rules:
valid-v-bind: warn # off, warn (default), error
svelte:
lint:
rules:
valid-v-bind: warn # off, warn (default), error
vue:
lint:
rules:
valid-v-bind: warn # off, warn (default), error

Enabled by the presets: html/eslint-plugin-vue-recommended.

Suppress one line with sudsy-disable-next-line valid-v-bind in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint-plugin-vue valid-v-bind full