# vue/no-unused-refs
disallow unused refs
# 📖 Rule Details
This rule is aimed at eliminating unused refs.
This rule reports refs that are defined using the ref
attribute in <template>
but are not used via $refs
.
Note
This rule cannot be checked for use in other components (e.g. mixins
, Access via $refs.x.$refs
).
<template>
<!-- ✓ GOOD -->
<input ref="foo" />
<!-- ✗ BAD (`bar` is not used) -->
<input ref="bar" />
</template>
<script>
export default {
mounted() {
this.$refs.foo.value = 'foo'
}
}
</script>
# 🔧 Options
Nothing.
# 🚀 Version
This rule was introduced in eslint-plugin-vue v7.9.0