oxc-project/oxc · info · OxcDiagnostic
Pass a callback function to `nextTick` instead of using the
Error message
Pass a callback function to `nextTick` instead of using the returned Promise.
What it means
Diagnostic from oxlint's vue/next-tick-style rule (style, autofixable, since oxlint 1.69.0). With the "callback" option (NextTickOption::Callback) it fires the opposite way: awaiting nextTick or chaining .then() is flagged, and the rule wants an explicit callback argument. Exists purely to enforce one team-wide nextTick idiom.
Source
Thrown at crates/oxc_linter/src/rules/vue/next_tick_style.rs:24
use oxc_macros::declare_oxc_lint;
use oxc_span::{GetSpan, Span};
use crate::{
AstNode,
context::LintContext,
rule::{DefaultRuleConfig, Rule},
utils::{is_this_object, is_vue_next_tick_import},
};
fn use_promise_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"Use the Promise returned by `nextTick` instead of passing a callback function.",
)
.with_label(span)
}
fn use_callback_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn(
"Pass a callback function to `nextTick` instead of using the returned Promise.",
)
.with_label(span)
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
enum NextTickOption {
/// Require using the Promise returned by `nextTick`.
#[default]
#[serde(rename = "promise")]
Promise,
/// Require passing a callback function to `nextTick`.
#[serde(rename = "callback")]
Callback,
}
#[derive(Debug, Default, Clone, Deserialize)]
pub struct NextTickStyle(NextTickOption);View on GitHub (pinned to e1e7af627c)
Solutions
- Pass a callback: this.$nextTick(() => { ... })
- Run oxlint --fix to convert automatically
- If await-style is preferred after all, switch the option back to "promise" (the default)
Example fix
// before (option "callback")
await this.$nextTick()
this.focusInput()
// after
this.$nextTick(() => { this.focusInput() }) Defensive patterns
Strategy: validation
Validate before calling
# find promise-style nextTick before enforcing "callback" grep -rnE "await +(this\.)?\$?nextTick|nextTick\(\)\.then" --include='*.vue' --include='*.js' src
Prevention
- Confirm the whole team wants callback style before setting the option; it fights async/await ergonomics
- Let oxlint --fix rewrite await-style calls mechanically
When it happens
Trigger: Config sets "vue/next-tick-style": ["error", "callback"] and code contains `await this.$nextTick()`, `await Vue.nextTick()`, or `nextTick().then(() => ...)`.
Common situations: Teams standardizing on callback style for Vue 2 compatibility or to avoid async function overhead in hot paths; newly added await-style code then fails the style gate in CI.
Related errors
- Use the Promise returned by `nextTick` instead of passing a
- Could not find the reuseWorker option in ${path}
- `VirtualFree` failed during cleanup: {err}
- Tried to get an allocator from an empty `FixedSizeAllocatorP
- Fixed size allocators are only supported on 64-bit little-en
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/cbb28eb8e12f194e.
Report an issue: GitHub.