{"record":{"id":"48f7e709326ce534","repo":"oxc-project/oxc","slug":"either-await-the-promise-or-pass-a-callback-functi","errorCode":null,"errorMessage":"Either await the Promise or pass a callback function to `nextTick`.","messagePattern":"Either await the Promise or pass a callback function to `nextTick`\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/valid_next_tick.rs","lineNumber":30,"sourceCode":"    rule::Rule,\n    utils::{is_in_vue_component_instance_method, is_this_object, is_vue_next_tick_import},\n};\n\nfn should_be_function_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`nextTick` is a function.\").with_label(span)\n}\n\nfn missing_callback_or_await_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Await the Promise returned by `nextTick` or pass a callback function.\")\n        .with_label(span)\n}\n\nfn too_many_parameters_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`nextTick` expects zero or one parameters.\").with_label(span)\n}\n\nfn either_await_or_callback_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Either await the Promise or pass a callback function to `nextTick`.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct ValidNextTick;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforce valid `nextTick` function calls.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// `nextTick` is a function that takes either a callback or returns a Promise.\n    /// Misuse (accessing it as a value, passing extra arguments, both awaiting and\n    /// passing a callback) is almost always a bug.\n    ///\n    /// ### Examples","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/valid_next_tick.rs#L12-L48","documentation":"Diagnostic from the oxlint rule `vue/valid-next_tick`. In `check_call`, after ruling out zero args and >1 args, if the single-argument call is ALSO 'awaited' per `is_awaited_promise` (parent is await/return/declarator/assignment/expression-arrow, a `.then` member, or inside `Promise.*` array), the rule reports both-consumed usage. Combining a callback with await (or with `.then`, or with `Promise.all`) is redundant: the callback fires on the same tick resolution AND the promise resolution path also runs, which is confusing and often double-handles the update.","triggerScenarios":"`await nt(callback)`, `await Vue.nextTick(callback)`, `await this.$nextTick(callback)`, and `nt(callback).then(anotherCallback)` (the `.then` parent marks the call awaited) inside a component instance method. One argument plus any await-style parent triggers it.","commonSituations":"Half-finished migrations from callback style to await style that leave the callback in place; defensive coding that both awaits and passes a callback 'to be sure'; chaining `.then` after a callback form.","solutions":["If you migrated to await style, drop the callback: `await nt()`.","If the callback is essential, remove the await: `nt(callback)`.","For `.then` chains, remove the callback argument: `nt().then(anotherCallback)`."],"exampleFix":"// before\nasync mounted() {\n  await this.$nextTick(callback);\n}\n\n// after\nasync mounted() {\n  await this.$nextTick();\n}","handlingStrategy":"validation","validationCode":"if (/await\\s+(?:this\\.\\$nextTick|Vue\\.nextTick|\\bnt)\\s*\\(\\s*\\S/.test(src) ||\n    /(?:this\\.\\$nextTick|Vue\\.nextTick|\\bnt)\\s*\\(\\s*\\S[^)]*\\)\\s*\\.then/.test(src)) {\n  console.warn('nextTick used with both a callback and await/.then — pick one');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Complete callback→Promise migrations: remove leftover callbacks once await is in place.","One nextTick consumption mechanism per call site."],"tags":["vue","nexttick","async","promise","lint","redundant"],"backgroundTag":"vue-nexttick-misuse","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}