{"record":{"id":"2ab5508101ae0b74","repo":"oxc-project/oxc","slug":"nexttick-is-a-function","errorCode":null,"errorMessage":"`nextTick` is a function.","messagePattern":"`nextTick` is a function\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/valid_next_tick.rs","lineNumber":17,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{CallExpression, Expression},\n};\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::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;","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/valid_next_tick.rs#L1-L35","documentation":"Diagnostic from the oxlint rule `vue/valid-next-tick` (crates/oxc_linter/src/rules/vue/valid_next_tick.rs). The rule matches three spellings inside Vue component instance methods: an identifier imported from 'vue' (even aliased, e.g. `nextTick as nt`), `Vue.nextTick`, and `this.$nextTick` (or `vm.$nextTick` where `vm` derives from `this`). If the matched reference is used as a value — its parent is not a call callee, not a variable declarator/assignment, and not a conditional — the rule reports '`nextTick` is a function.' and offers an auto-fix that appends `()` after the reference. Referencing the function without calling it does nothing (e.g. `this.$nextTick;` is a no-op statement, `nt.then(cb)` calls `.then` on the function itself).","triggerScenarios":"Inside a component instance context (lifecycle hooks like `mounted`, `methods`, or objects passed to `new Vue(...)`, `Vue.extend`, `Vue.mixin`, `defineNuxtComponent`): a bare `this.$nextTick;` statement, `await nt;`, `return this.$nextTick;`, `nt.then(callback)`, or `Promise.all([nt, other])`. Parents that are OK: `foo.then(nt)` (argument position), `let foo = nt`, `foo = nt`, and `bar ? nt : undefined`. The auto-fix inserts `()` at the end of the reference span.","commonSituations":"Forgetting the parentheses when converting callback style to await style; `Promise.all([this.$nextTick, fetch(...)])` that silently awaits the function object instead of a Promise; refactoring that leaves a stray `this.$nextTick` expression statement.","solutions":["Invoke it: `await this.$nextTick()` / `nt()` — or run `oxlint --fix`, which appends the missing `()` automatically.","If you meant to pass the function itself, wrap usage accordingly (`foo.then(nt)` as a call argument is accepted and correct).","For arrays passed to `Promise.all`, call each entry: `Promise.all([nt(), otherPromise])`."],"exampleFix":"// before\nasync mounted() {\n  await this.$nextTick;\n  Promise.all([nt, otherPromise]);\n}\n\n// after\nasync mounted() {\n  await this.$nextTick();\n  Promise.all([nt(), otherPromise]);\n}","handlingStrategy":"validation","validationCode":"// Flag nextTick used as a value without being called\nconst re = /(?:this\\.\\$nextTick|Vue\\.nextTick|\\bnt\\b)(?!\\s*\\()/g;\nfor (const m of src.matchAll(re)) {\n  const after = src.slice(m.index + m[0].length, m.index + m[0].length + 20);\n  if (!/^\\s*(?:;|\\)|,|=|\\.then|$)/.test(after)) continue; // rough context filter\n  console.warn(`nextTick referenced without call at offset ${m.index}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write nextTick with parentheses, even in await/return positions: `await this.$nextTick()`.","Run `oxlint --fix` in CI or pre-commit — the rule auto-inserts the missing ().","In Promise.all arrays, double-check every entry is a call, not the function itself."],"tags":["vue","nexttick","async","lint","autofix"],"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-14T00:17:10.932Z"}