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

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

Open Ericlm opened this issue 1 year ago • 1 comments

⚠️ 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:

  • If defineExpose is declared inside the order, I guess it should be ignored? Otherwise it would conflict with defineExposeLast I guess.
  • Maybe the check could be more performant if there was no check against ORDER_SCHEMA in the condition? (removing the callbacks and the call to has()).

See #2499

Ericlm avatar Jul 08 '24 18:07 Ericlm

You're welcome! Really happy to add this 😁

Ericlm avatar Jul 09 '24 14:07 Ericlm