eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

`define-macros-order`: option to allow compile only TypeScript code between macros

Open andreww2012 opened this issue 2 weeks ago • 1 comments

What rule do you want to change?

define-macros-order

Does this change cause the rule to produce more or fewer warnings?

Less

How will the change be implemented? (New option, new default behavior, etc.)?

Sometimes it's useful to put some types between macro definitions (for example, if they're only used inside the macro following the type declaration):

<script setup lang="ts">
defineProps(/* ... */)

type Foo = 'bar';

defineEmits(/* ... */)
</script>

However, currently any type declaration between macros are disallowed by this rule. It would be nice to introduce an option, say allowTypesBetweenMacros, to control whether non-runtime TS code will be allowed between macros.

Please provide some example code that this change will affect:

See above

What does the rule currently do for this code?

Reports

What will the rule do after it's changed?

Will not report

Additional context

andreww2012 avatar Nov 26 '25 18:11 andreww2012