-
-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support multiple macro calls in vue/define-macros-order #2386
fix: support multiple macro calls in vue/define-macros-order #2386
Conversation
{ | ||
order: ['defineModel', 'defineSlots'] | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR!
Could you also add invalid test cases with multiple defineModels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a couple I could think of. Also one that tests that order of occurrence is maintained and not re-ordered like I suggested in the initial issue
Can you think of any other interesting cases to check?
lib/rules/define-macros-order.js
Outdated
.map((name) => ({ name, node: macrosNodes.get(name) })) | ||
.flatMap((name) => { | ||
const nodes = macrosNodes.get(name) ?? [] | ||
return nodes?.map((node) => ({ name, node })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be undefined, since you are using ??
above.
return nodes?.map((node) => ({ name, node })) | |
return nodes.map((node) => ({ name, node })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch ;)
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
Not a pro when it comes to AST stuff, but I think this should do it.
Should fix #2371