noVueDeprecatedListeners (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v2.6.4 - Diagnostic Category:
lint/nursery/noVueDeprecatedListeners - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noVueDeprecatedListeners": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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>Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.