vue/next-tick-style Style
What it does
Enforce Promise or callback style in nextTick.
Why is this bad?
In Vue.js, nextTick can be used either by passing a callback or by using the returned Promise. Mixing these styles makes the code harder to read and inconsistent. Choose one style consistently.
Examples
Examples of incorrect code for this rule with default "promise" option:
this.$nextTick(() => {});
Vue.nextTick(() => {});
import { nextTick } from "vue";
nextTick(() => {});Examples of correct code for this rule with default "promise" option:
this.$nextTick().then(() => {});
await Vue.nextTick();
import { nextTick } from "vue";
await nextTick();Examples of incorrect code for this rule with "callback" option:
await this.$nextTick();
Vue.nextTick().then(() => {});Examples of correct code for this rule with "callback" option:
this.$nextTick(() => {});
Vue.nextTick(() => {});Configuration
This rule accepts one of the following string values:
"promise"
Require using the Promise returned by nextTick.
"callback"
Require passing a callback function to nextTick.
How to use
To enable this rule using the config file or in the CLI, you can use:
{
"plugins": ["vue"],
"rules": {
"vue/next-tick-style": "error"
}
}import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["vue"],
rules: {
"vue/next-tick-style": "error",
},
});oxlint --deny vue/next-tick-style --vue-pluginVersion
This rule was added in vnext.
