vue/next-tick-style
Enforce Promise-style nextTick usage.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
None | No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
A callback is passed to nextTick.
<script setup>
import { nextTick } from "vue"
nextTick(() => focusInput())
</script>
<template />
Good
The code awaits the Promise before continuing.
<script setup>
import { nextTick } from "vue"
await nextTick()
focusInput()
</script>
<template />
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/next-tick-style": "warn"
}
},
});
Then run vp run lint.