Skip to content

useVueValidVOnce

biome.json
{
"linter": {
"rules": {
"correctness": {
"useVueValidVOnce": "error"
}
}
}
}

Enforce valid v-once Vue directives.

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

The directive has an argument so it is invalid.

<div v-once:arg></div>
code-block.vue:1:12 lint/correctness/useVueValidVOnce  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The v-once directive must not have an argument.

> 1 │ <div v-once:arg></div>
^^^^
2 │

Use v-once without arguments, e.g. v-once.

Unsafe fix: Remove the argument.

1 │ <div·v-once:arg></div>
----

The directive has a modifier so it is invalid.

<div v-once.mod></div>
code-block.vue:1:12 lint/correctness/useVueValidVOnce  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The v-once directive does not support modifiers.

> 1 │ <div v-once.mod></div>
^^^^
2 │

Remove the modifier; v-once is a stand-alone control directive.

Unsafe fix: Remove the modifier.

1 │ <div·v-once.mod></div>
----

The directive has a value so it is invalid.

<div v-once="value"></div>
code-block.vue:1:12 lint/correctness/useVueValidVOnce  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The v-once directive must not have a value.

> 1 │ <div v-once=“value”></div>
^^^^^^^^
2 │

v-once is a boolean-like directive and should be used without a value.

Unsafe fix: Remove the value.

1 │ <div·v-once=value></div>
--------
<div v-once></div>