Back to Biomejs

useVueValidVOn

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

latest1.8 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/useVueValidVOn`](/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-on`](https://eslint.vuejs.org/rules/valid-v-on)

How to configure

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

Description

Enforce valid v-on directives with proper arguments, modifiers, and handlers.

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

  • The directive does not have an event name. E.g. <div v-on="foo"></div>
  • The directive has invalid modifiers. E.g. <div v-on:click.bogus="foo"></div>
  • The directive is missing a handler expression. E.g. <div v-on:click></div>

Examples

Invalid

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

Valid

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