Skip to content

Allow specifying custom macros in vue/define-macros-order #2499

Closed
@Ericlm

Description

@Ericlm

What rule do you want to change?
I would like to update the define-macros-order rule.

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

How will the change be implemented? (New option, new default behavior, etc.)?
With the unplugging-vue-router which allows routes to be typesafe, there is now a new definePage macro that allows to customize the generated route.

I think this macro should be ordered just like defineProps, emits, slots etc. I think it could be at the top of the component, even before defineModel.

Please provide some example code that this change will affect:

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

definePage({}) // Can be placed anywhere

function hello(): void {
  router.push({ name: '/' })
}
</script>

What does the rule currently do for this code?
The rule does not enforce a location for definePage, so it can be placed anywhere in the script.

What will the rule do after it's changed?
It will enforce the definePage macro to be at the top of the script (or elsewhere).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions