Back to Biomejs

useVueConsistentVBindStyle

src/content/docs/linter/rules/use-vue-consistent-v-bind-style.mdx

latest2.0 KB
Original Source

import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs> <TabItem label="HTML" icon="seti:html"> :::caution This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time. ::: ## Summary - Rule available since: `v2.3.11` - Diagnostic Category: [`lint/nursery/useVueConsistentVBindStyle`](/reference/diagnostics#diagnostic-category) - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). - This rule belongs to the following domains: - [`vue`](/linter/domains#vue) - Sources: - Same as [`vue/v-bind-style`](https://eslint.vuejs.org/rules/v-bind-style)

How to configure

json
{
	"linter": {
		"rules": {
			"nursery": {
				"useVueConsistentVBindStyle": "error"
			}
		}
	}
}

Description

Enforce a consistent style for v-bind in Vue templates.

Examples

Invalid

vue
<div v-bind:foo="bar" />
<pre class="language-text"><code class="language-text"></code></pre>

Valid

vue
<div :foo="bar" />

Options

style

Configures the preferred directive style. Default: "shorthand".

json
{
	"linter": {
		"rules": {
			"nursery": {
				"useVueConsistentVBindStyle": {
					"options": {
						"style": "longhand"
					}
				}
			}
		}
	}
}

Invalid

vue
<div :foo="bar" />
<pre class="language-text"><code class="language-text"></code></pre>

Valid

vue
<div v-bind:foo="bar" />
</TabItem> </Tabs>