{"record":{"id":"cbb28eb8e12f194e","repo":"oxc-project/oxc","slug":"pass-a-callback-function-to-nexttick-instead-of","errorCode":null,"errorMessage":"Pass a callback function to `nextTick` instead of using the returned Promise.","messagePattern":"Pass a callback function to `nextTick` instead of using the returned Promise\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"info","filePath":"crates/oxc_linter/src/rules/vue/next_tick_style.rs","lineNumber":24,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n    utils::{is_this_object, is_vue_next_tick_import},\n};\n\nfn use_promise_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\n        \"Use the Promise returned by `nextTick` instead of passing a callback function.\",\n    )\n    .with_label(span)\n}\n\nfn use_callback_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\n        \"Pass a callback function to `nextTick` instead of using the returned Promise.\",\n    )\n    .with_label(span)\n}\n\n#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]\nenum NextTickOption {\n    /// Require using the Promise returned by `nextTick`.\n    #[default]\n    #[serde(rename = \"promise\")]\n    Promise,\n    /// Require passing a callback function to `nextTick`.\n    #[serde(rename = \"callback\")]\n    Callback,\n}\n\n#[derive(Debug, Default, Clone, Deserialize)]\npub struct NextTickStyle(NextTickOption);","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/next_tick_style.rs#L6-L42","documentation":"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.","triggerScenarios":"Config sets \"vue/next-tick-style\": [\"error\", \"callback\"] and code contains `await this.$nextTick()`, `await Vue.nextTick()`, or `nextTick().then(() => ...)`.","commonSituations":"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.","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)"],"exampleFix":"// before (option \"callback\")\nawait this.$nextTick()\nthis.focusInput()\n// after\nthis.$nextTick(() => { this.focusInput() })","handlingStrategy":"validation","validationCode":"# find promise-style nextTick before enforcing \"callback\"\ngrep -rnE \"await +(this\\.)?\\$?nextTick|nextTick\\(\\)\\.then\" --include='*.vue' --include='*.js' src","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the whole team wants callback style before setting the option; it fights async/await ergonomics","Let oxlint --fix rewrite await-style calls mechanically"],"tags":["vue","oxlint","lint","nexttick","style","autofix"],"backgroundTag":"vue-next-tick-style","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}