Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 1.92 KB

define-macros-order.md

File metadata and controls

71 lines (53 loc) · 1.92 KB
pageClass sidebarDepth title description
rule-details
0
vue/define-macros-order
enforce order of `defineEmits` and `defineProps` compiler macros

vue/define-macros-order

enforce order of defineEmits and defineProps compiler macros

  • This rule has not been released yet.
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule reports the defineProps and defineEmits compiler macros when they are not the first statements in <script setup> (after any potential import statements or type definitions) or when they are not in the correct order.

🔧 Options

{
  "vue/define-macros-order": ["error", {
    "order": ["defineEmits", "defineProps"]
  }]
}
  • order (string[]) ... The order of defineEmits and defineProps macros

{ "order": ["defineEmits", "defineProps"] } (default)

<!-- ✓ GOOD -->
<script setup>
defineEmits(/* ... */)
defineProps(/* ... */)
</script>
<!-- ✗ BAD -->
<script setup>
defineProps(/* ... */)
defineEmits(/* ... */)
</script>
<!-- ✗ BAD -->
<script setup>
const bar = ref()
defineEmits(/* ... */)
defineProps(/* ... */)
</script>

🔍 Implementation