Skip to content

useVueValidVOn

  • Rule available since: v2.3.6
  • Diagnostic Category: lint/correctness/useVueValidVOn
  • This rule is recommended, meaning it is enabled by default.
  • This rule doesn’t have a fix.
  • The default severity of this rule is error.
  • This rule belongs to the following domains:
  • Sources:
biome.json
{
"linter": {
"rules": {
"correctness": {
"useVueValidVOn": "error"
}
}
}
}

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

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

  • The directive has neither an event name nor a value (an arg-less v-on with a value is the object syntax, e.g. <div v-on="$listeners"></div>, which is valid).
  • The directive has invalid modifiers. E.g. <div v-on:click.bogus="foo"></div>
  • The directive is missing a handler expression, unless one of the verb modifiers (stop, prevent) is present. The verb modifiers carry an intrinsic side effect (event.stopPropagation() / event.preventDefault()) and are valid Vue syntax without a handler. E.g. <div v-on:click></div> is invalid but <div @click.stop></div> is valid.
<Foo v-on />
<Foo v-on:click="foo" />
<div @click.stop></div>