Closed
Description
Please describe what the rule should do:
The rule would force to have defineExpose
at the end of the <script>
tag. When <script setup>
is used, defineExpose
is used as the alternative to return
and is often expected to be at the end the same way return
was. It also uses the data used in <script>
and should therefore not be placed before the data itself. It is similar to vue/define-macros-order
where define macros are forced at the beginning of <script>
.
What category should the rule belong to?
[X] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
<script setup>
const counter = ref(0);
const title = ref('');
defineExpose({
counter,
title,
});
const itemsText = computed(() => `${ counter.value } items`);
</script>
<script setup>
const counter = ref(0);
const title = ref('');
defineExpose({
counter,
title,
});
const shown = ref(false);
function show() {
show.value = true;
}
watch(counter, show);
</script>
Additional context