Vue · VUE0030

Disable inheritAttrs when binding $attrs

Flags single-root components that forward `v-bind="$attrs"` to an inner element while Vue still applies the same attrs to the root.
VUE0030vite-doctor/vueattrswarnNo fix

Run this rule

pnpm vite-doctor . --framework vue --rules vue/attrs/no-duplicate-attr-inheritance

Why it matters

With inheritAttrs left on, fallthrough attrs land on the component root and on the element that binds $attrs, so classes and ids are duplicated and bubbling listeners such as @click run twice.

Add defineOptions({ inheritAttrs: false }) so attrs reach only the element that binds $attrs.

Example

Turn off attribute inheritance when forwarding $attrs

Before

<template>
  <label class="field">
    <input v-bind="$attrs">
  </label>
</template>

After

<script setup lang="ts">
defineOptions({ inheritAttrs: false })
</script>

<template>
  <label class="field">
    <input v-bind="$attrs">
  </label>
</template>
Copyright © 2026