Skip to content

noVueDeprecatedListeners (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"nursery": {
"noVueDeprecatedListeners": "error"
}
}
}
}

Disallow the deprecated Vue $listeners API.

Vue 3 removed $listeners. Event listeners passed to a component are now part of $attrs, so code that still reads $listeners no longer receives them. Use $attrs instead when migrating a component from Vue 2.

See the Vue 3 migration guide for more information.

<script>
export default {
mounted() {
console.log(this.$listeners);
}
};
</script>
code-block.vue:4:22 lint/nursery/noVueDeprecatedListeners ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ The Vue $listeners API is deprecated.

2 │ export default {
3 │ mounted() {
> 4 │ console.log(this.$listeners);
│ ^^^^^^^^^^
5 │ }
6 │ };

ℹ Vue 3 removed $listeners and passes event listeners to the component through $attrs instead.

ℹ Use $attrs. See the Vue 3 migration guide for more information.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<script>
export default {
mounted() {
console.log(this.$attrs);
}
};
</script>