Back to Biomejs

useVueValidVBind

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

latest1.9 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.6` - Diagnostic Category: [`lint/nursery/useVueValidVBind`](/reference/diagnostics#diagnostic-category) - This rule doesn't have a 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/valid-v-bind`](https://eslint.vuejs.org/rules/valid-v-bind)

How to configure

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

Description

Forbids v-bind directives with missing arguments or invalid modifiers.

This rule reports v-bind directives in the following cases:

  • The directive does not have an argument. E.g. <div v-bind></div>
  • The directive does not have a value. E.g. <div v-bind:aaa></div>
  • The directive has invalid modifiers. E.g. <div v-bind:aaa.bbb="ccc"></div>

Examples

Invalid

vue
<Foo v-bind />
<pre class="language-text"><code class="language-text"></code></pre>
vue
<div v-bind></div>
<pre class="language-text"><code class="language-text"></code></pre>

Valid

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