vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.47k stars 666 forks source link

Update rule `define-macros-order` for custom macros #2501

Closed Ericlm closed 2 months ago

Ericlm commented 4 months ago

⚠️ Newbie alert ⚠️ This is my very first contribution to this project so I hope I did the things well; but don't hesitate to tell me what is not right. 😄

This PR adds the ability to use the define macro order rule for any macro specified in the order array. This allows users to specify definePage for example or any macro wanted.

Basically, I added a CallExpression that checks whether the Identifier is included into the order array but not in the ORDER_SCHEMA as this is already checked with earlier events (onDefineExposeExit etc.) I removed the enum from the properties of the rule as it's no longer limited to ORDER_SCHEMA. And finally, I've added new tests.

I also have some questions:

See #2499

Ericlm commented 4 months ago

You're welcome! Really happy to add this 😁