Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.39 KB

max-props.md

File metadata and controls

62 lines (43 loc) · 1.39 KB
pageClass sidebarDepth title description
rule-details
0
vue/max-props
enforce maximum number of props in Vue component

vue/max-props

enforce maximum number of props in Vue component

  • This rule has not been released yet.

📖 Rule Details

This rule enforces a maximum number of props in a Vue SFC, in order to aid in maintainability and reduce complexity.

🔧 Options

This rule takes an object, where you can specify the maximum number of props allowed in a Vue SFC. There is one property that can be specified for the object.

  • maxProps ... Specify the maximum number of props in the script block.

{ maxProps: 1 }

<!-- ✗ BAD -->
<template>
</template>

<script setup>
defineProps({ 
  prop1: String,
  prop2: String,
})
</script>

{ maxProps: 5 }

<!-- ✓ GOOD -->
<script>
defineProps({
  prop1: String
})
</script>

🔍 Implementation