useVueValidVOn
Summary
Section titled “Summary”- 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:
- Same as
vue/valid-v-on
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "correctness": { "useVueValidVOn": "error" } } }}Description
Section titled “Description”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-onwith 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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<Foo v-on /><Foo v-on:click="foo" /><div @click.stop></div>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.