Skip to content

Rule suggestion: vue/valid-next-tick #1399

Closed
@FloEdelmann

Description

@FloEdelmann

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

Should #1318 be part of this rule (with option enforceStyle: 'promise' or enforceStyle: 'callback')?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions