Vue · Architecture

VUE0038Avoid components that only relay props

Finds Vue components whose template renders one child and whose props and events only pass straight through to it.

Why it happens

A wrapper that declares most of its child's props, binds them unchanged, and re-emits the child's events adds a component instance to every render and a second copy of the child's contract. Every prop or event change has to be made in both components, and data that only travels through the wrapper to reach a descendant hides which component owns the interaction. Doctor reports a wrapper only when its template is that single child and it adds no markup, logic, static props, or defaults of its own.

Fix

Render the child directly where the wrapper is used and delete the wrapper, or merge the wrapper into the child when it has one caller. Pass caller-owned content through slots. When the props only travel through to reach a deeper descendant, move that state to the component that owns the interaction, and use provide/inject only for state several descendants genuinely share. Keep a wrapper that adds UI, policy, or encapsulation.

Example

Render the child instead of a pass-through wrapper

Before

<!-- UserPanel.vue -->
<script setup lang="ts">
import UserCard from './UserCard.vue'
const props = defineProps<{ user: User; compact?: boolean }>()
const emit = defineEmits<{ select: [id: string] }>()
</script>

<template>
  <UserCard :user="user" :compact="compact" @select="emit('select', $event)" />
</template>

After

<!-- UserList.vue renders UserCard directly -->
<script setup lang="ts">
import UserCard from './UserCard.vue'
defineProps<{ users: User[] }>()
const selected = defineModel<string>('selected')
</script>

<template>
  <UserCard v-for="user in users" :key="user.id" :user="user" compact @select="selected = $event" />
</template>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework vue --extends auto,vue/strict --rules vue/component/no-prop-relay
Copyright © 2026