pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
vue/v-bind-style |
enforce `v-bind` directive style |
v3.0.0 |
enforce
v-bind
directive style
- ⚙️ This rule is included in all of
"plugin:vue/vue3-strongly-recommended"
,*.configs["flat/strongly-recommended"]
,"plugin:vue/strongly-recommended"
,*.configs["flat/vue2-strongly-recommended"]
,"plugin:vue/vue3-recommended"
,*.configs["flat/recommended"]
,"plugin:vue/recommended"
and*.configs["flat/vue2-recommended"]
. - 🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
This rule enforces v-bind
directive style which you should use shorthand or long form.
<template>
<!-- ✓ GOOD -->
<div :foo="bar" />
<!-- ✗ BAD -->
<div v-bind:foo="bar" />
</template>
{
"vue/v-bind-style": ["error", "shorthand" | "longform", {
"sameNameShorthand": "ignore" | "always" | "never"
}]
}
"shorthand"
(default) ... requires using shorthand."longform"
... requires using long form.sameNameShorthand
... enforce thev-bind
same-name shorthand style (Vue 3.4+)."ignore"
(default) ... ignores the same-name shorthand style."always"
... always enforces same-name shorthand where possible."never"
... always disallow same-name shorthand where possible.
<template>
<!-- ✓ GOOD -->
<div v-bind:foo="bar" />
<!-- ✗ BAD -->
<div :foo="bar" />
</template>
<template>
<!-- ✓ GOOD -->
<div :foo />
<!-- ✗ BAD -->
<div :foo="foo" />
</template>
<template>
<!-- ✓ GOOD -->
<div :foo="foo" />
<!-- ✗ BAD -->
<div :foo />
</template>
This rule was introduced in eslint-plugin-vue v3.0.0