Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork698
Description
Checklist
- I have tried restarting my IDE and the issue persists.
- I have read theFAQ and my problem is not listed.
Tell us about your environment
- ESLint version: 9.37.0
- eslint-plugin-vue version: 10.5.0
- Vue version: 3.5.22
- Node version: 24.7.0
- Operating System: Gentoo Linux
What did you do?
Given the following configuration (taken from therule documentat):
{rules:{"vue/define-macros-order":["error",{"order":["defineOptions","defineModel","defineProps","defineEmits",defineSlots"]},},}
And the following code (also from the documentation, but withdefineOptions moved to the top):
<script setup>defineOptions({/* ...*/})defineEmits(/* ...*/)constslots=defineSlots()defineProps(/* ...*/)constmodel=defineModel()</script>
What did you expect to happen?
defineModel should be above defineEmits
Since we know the order of the macros (from configuration) it would make sense if the error contained the expected ordering.
If we compare with thevue/order-in-components rule where we get an error similar to:
The "..." property should be above the "..." property on line [..]
What actually happened?
defineModel should be the first statement in
<script setup>(after any potential import statements or type definitions).
Autofixing the error works,defineModel() is moved to the proper location. But the error is confusing and would make one try to move it to the top abovedefineOptions but doing that putsdefineOptions in the wrong order and you get a new error instead. If multiple of the macros are out-of-order (as might happen if you just turn this on) you get an endless supply of these confusing errors. Almost like a puzzle, you keep trying all kinds of combinations until you at some point happen to stumble upon the correct ordering.