Skip to content

New option for next-tick-style #2485

Open
@fisker

Description

@fisker
Contributor

What rule do you want to change?

next-tick-style

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

No.

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

If inside async function, provide autofix, otherwise no fix.

Please provide some example code that this change will affect:

<script setup>
const foo = () => {
	nextTick(() => {
	  // ...
	})
}
</script>

What does the rule currently do for this code?

Fixes my code to nextTick().then(...)

What will the rule do after it's changed?

Enforce await nextTick()

Additional context

I want the promise style use of nextTick(), but I don't want it fix to nextTick().then, I want await nextTick().

Activity

FloEdelmann

FloEdelmann commented on Jul 1, 2024

@FloEdelmann
Member

You could use eslint-plugin-promise's prefer-await-to-then rule.

However, improving the autofix to use await nextTick() inside functions that are already async seems like a good idea to me. PR welcome for that!

codiini

codiini commented on Jul 9, 2024

@codiini

@FloEdelmann I'd like to pick this up

FloEdelmann

FloEdelmann commented on Jul 9, 2024

@FloEdelmann
Member

Sure, go ahead 🙂

codiini

codiini commented on Jul 15, 2024

@codiini

@FloEdelmann I've submitted a PR  😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @fisker@FloEdelmann@codiini

      Issue actions

        New option for `next-tick-style` · Issue #2485 · vuejs/eslint-plugin-vue