Skip to content

vue/define-macros-order Ignore TS type sorting #2380

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

Open
honghuangdc opened this issue Jan 25, 2024 · 3 comments
Open

vue/define-macros-order Ignore TS type sorting #2380

honghuangdc opened this issue Jan 25, 2024 · 3 comments

Comments

@honghuangdc
Copy link

honghuangdc commented Jan 25, 2024

What rule do you want to change?
ignore TS type sorting

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

How will the change be implemented? (New option, new default behavior, etc.)?

Please provide some example code that this change will affect:

// the rule will sort the following code

interface Props {
  msg: string;
}

const props = defineProps<Props>();

interface Emits {
  (e: 'update'): void;
}

const emit = defineEmits<Emits>();

// after sorting

const props = defineProps<Props>();

const emit = defineEmits<Emits>();

interface Props {
  msg: string
}

interface Emits {
  (e: 'update'): void;
}

What does the rule currently do for this code?

What will the rule do after it's changed?
ignore sort TS type

Additional context

@FloEdelmann
Copy link
Member

If you don't like the rule, please disable it. Otherwise, please explain what exactly you want to change.

@FloEdelmann FloEdelmann closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2024
@conarti
Copy link

conarti commented Apr 1, 2025

Hi @FloEdelmann, I’ve encountered a similar issue with this rule in my own project. The rule currently doesn’t take into account interfaces or aliases used in defineProps or defineEmits. Because of that, the macro declarations are separated from the types they rely on, which affects readability and organization.

I’d like to suggest enhancing the rule so that if an alias or interface is used in a macro, it is automatically grouped and moved together with the macro.

Thanks!

@FloEdelmann
Copy link
Member

FloEdelmann commented May 21, 2025

it is automatically grouped and moved together with the macro

I think that is too opinionated and too much for this rule. But ignoring TS interfaces and types before or between macros s probably a good idea. Pull requests are welcome for that!

@FloEdelmann FloEdelmann reopened this May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants