JS.VUE.DEFINE.MACROS.ORDER
Define compiler macros are not the first statements in `<script setup>` or they are not in the correct order
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
Copy
{
"vue/define-macros-order": ["error", {
"order": ["defineProps", "defineEmits"]
}]
}
order
(string[]
) ... The order of defineEmits and defineProps macros
{ "order": ["defineProps", "defineEmits"] }
(default)
{'vue/define-macros-order': ['error']}
Copy
<!-- GOOD -->
<script setup>
defineProps(/* ... */)
defineEmits(/* ... */)
</script>
{'vue/define-macros-order': ['error']}
Copy
<!-- BAD -->
<script setup>
defineEmits(/* ... */)
defineProps(/* ... */)
</script>
{'vue/define-macros-order': ['error']}
Copy
<!-- BAD -->
<script setup>
const bar = ref()
defineProps(/* ... */)
defineEmits(/* ... */)
</script>