Vue · VUE0031

Do not give required props a default

Flags props declared as required that also define a default value.
VUE0031vite-doctor/vuepropswarnNo fix

Run this rule

pnpm vite-doctor . --framework vue --rules vue/props/no-required-prop-with-default

Why it matters

Parents that omit a required prop get a type error with type-based props and Vue's "Missing required prop" warning in development, yet the default still fills the value at runtime, so the declared contract and the actual behavior disagree.

Make the prop optional when the default is the intended fallback, or remove the default when every parent must pass the prop.

Example

Make defaulted props optional

Before

<script setup lang="ts">
const props = withDefaults(defineProps<{ size: string }>(), {
  size: 'md',
})
</script>

After

<script setup lang="ts">
const props = withDefaults(defineProps<{ size?: string }>(), {
  size: 'md',
})
</script>
Copyright © 2026