Skip to content
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

New option for next-tick-style #2485

Open
fisker opened this issue Jun 25, 2024 · 4 comments · May be fixed by #2508
Open

New option for next-tick-style #2485

fisker opened this issue Jun 25, 2024 · 4 comments · May be fixed by #2508

Comments

@fisker
Copy link
Contributor

fisker commented Jun 25, 2024

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().

@FloEdelmann
Copy link
Member

FloEdelmann commented Jul 1, 2024

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
Copy link

codiini commented Jul 9, 2024

@FloEdelmann I'd like to pick this up

@FloEdelmann
Copy link
Member

Sure, go ahead 🙂

@codiini codiini linked a pull request Jul 11, 2024 that will close this issue
@codiini
Copy link

codiini commented Jul 15, 2024

@FloEdelmann I've submitted a PR  😄

@FloEdelmann FloEdelmann linked a pull request Aug 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants