-
-
Couldn't load subscription status.
- Fork 696
Open
Description
What did you do?
define-macros-order should probably allow referencing local variables defined before the macros:
<script setup lang="ts">
/* eslint vue/define-macros-order: [2, {order: ["defineOptions", "defineModel", "defineProps", "defineEmits", "defineSlots"]}] no-use-before-define: 2 */
import {ref} from 'vue';
const lastSetModelValue = ref<string>();
// "defineModel should be the first statement in `<script setup>` (after any potential import statements or type definitions)",
// but it's not safe to move `lastSetModelValue` after the macros
const [modelValue, modelModifiers] = defineModel<string>({
set: (value: string) => {
lastSetModelValue.value = value;
return value;
},
get: (value: string) => {
return lastSetModelValue.value ?? value;
},
});
</script>What did you expect to happen?
The rule should not report .
If lastSetModelValue definition is moved below defineModel, no-use-before-define will be triggered as well as define-macros-order on the following macros definitions.
Repository to reproduce this issue
OrbisK
Metadata
Metadata
Assignees
Labels
No labels