A Vue computed property is an async function, so its value is a promise
What it finds
Computed properties are evaluated synchronously and cached. An async function returns a promise, so the template renders [object Promise] and the value never updates when the promise settles. A watcher or an effect that sets state does asynchronous work.
Reported are async functions in the computed option of components and given to computed from Vue.
From the rule's source, async_computed.rs.
import { computed, ref } from "vue";const id = ref(1);export const user = computed(async () => fetch(`/users/${id.value}`));tx0 reports: this computed value is asyncexport const name = computed(() => String(id.value)); Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:async-computed" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:async-computed] reason="..."tx0 explain tx0/ts:async-computed shows the same in the terminal. Found a false positive? Report it.