Skip to content

useVueValidVOn

¥Summary

¥How to configure

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

¥Description

强制使用带有正确参数、修饰符和处理程序的有效 v-on 指令。

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

此规则会在以下情况下报告 v-on 指令:

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

  • 该指令没有事件名称。例如<div v-on="foo"></div>

    ¥The directive does not have an event name. E.g. <div v-on="foo"></div>

  • 该指令包含无效修饰符。例如<div v-on:click.bogus="foo"></div>

    ¥The directive has invalid modifiers. E.g. <div v-on:click.bogus="foo"></div>

  • 该指令缺少处理表达式。例如<div v-on:click></div>

    ¥The directive is missing a handler expression. E.g. <div v-on:click></div>

¥Examples

¥Invalid

<Foo v-on />

¥Valid

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

¥Related links