{"record":{"id":"7ead476e764751c1","repo":"oxc-project/oxc","slug":"use-the-promise-returned-by-nexttick-instead-of","errorCode":null,"errorMessage":"Use the Promise returned by `nextTick` instead of passing a callback function.","messagePattern":"Use the Promise returned by `nextTick` instead of passing a callback function\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"info","filePath":"crates/oxc_linter/src/rules/vue/next_tick_style.rs","lineNumber":17,"sourceCode":"use schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse 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,","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/next_tick_style.rs#L1-L35","documentation":"Diagnostic from oxlint's vue/next-tick-style rule (style, autofixable, since oxlint 1.69.0). With the default \"promise\" option it fires when a callback is passed to nextTick instead of using the returned Promise. Mixing both styles hurts readability; the Promise form composes with async/await. The rule recognizes this.$nextTick, Vue.nextTick, and imported nextTick (via is_vue_next_tick_import).","triggerScenarios":"Rule at default (NextTickOption::Promise) and code contains `this.$nextTick(() => {...})`, `Vue.nextTick(cb)`, or `import { nextTick } from 'vue'; nextTick(cb)`.","commonSituations":"Codebases migrating from Vue 2 habits (callback-style nextTick) to Vue 3 async/await style; enabling the vue style preset in oxlint and having legacy callback calls flagged.","solutions":["Use the Promise: await this.$nextTick() inside an async method, or this.$nextTick().then(cb)","Run oxlint --fix to autofix (the rule is marked fix)","If the team prefers callbacks, set the option to \"callback\""],"exampleFix":"// before (option \"promise\", the default)\nthis.$nextTick(() => { this.focusInput() })\n// after\nawait this.$nextTick()\nthis.focusInput()","handlingStrategy":"validation","validationCode":"# find callback-style nextTick calls before enforcing \"promise\"\ngrep -rnE \"(this\\.)?\\$?nextTick\\(\\s*[A-Za-z$_(]\" --include='*.vue' --include='*.js' src","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run oxlint --fix in CI or pre-commit; this rule is autofixable","Standardize on await nextTick() in new code and let the rule convert the legacy calls"],"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-14T05:17:10.506Z"}