Closed
Description
Please describe what the rule should do:
Calling Vue.nextTick
or vm.$nextTick
without passing a callback and without awaiting the returned Promise is likely a mistake (probably a missing await
).
What category should the rule belong to?
[ ] Enforces code style (layout)
[X] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
import { nextTick as nt } from 'vue';
// BAD:
nt();
Vue.nextTick();
this.$nextTick();
nt;
Vue.nextTick;
this.$nextTick;
// GOOD:
await nt();
await Vue.nextTick();
await this.$nextTick();
nt().then(callback);
Vue.nextTick().then(callback);
this.$nextTick().then(callback);
nt(callback);
Vue.nextTick(callback);
this.$nextTick(callback);
Additional context
Vue.nextTick
API in Vue 2vm.$nextTick
API in Vue 2- Global API Treeshaking
- Global
nextTick
API in Vue 3 - Instance
$nextTick
API in Vue 3
Should #1318 be part of this rule (with option enforceStyle: 'promise'
or enforceStyle: 'callback'
)?