Skip to content

vue-doctor/reactivity/no-watch-for-computed ​

Replace the watcher with a computed property: const value = computed(() => transform(source))

PropertyValue
CategoryReactivity
Default Severitywarning
Confidencemedium
FixableNo
Engineoxlint
Sincev1.0.0
Frameworksvue, nuxt

Why it matters ​

Replace the watcher with a computed property: const value = computed(() => transform(source))

How to fix ​

Review the finding and update the code according to best practices below.

Agent Guidance ​

The watcher only derives a ref from its source, and nothing else writes that ref. Delete the watcher and the ref, and declare const value = computed(() => ...) using the same source. Refs that the user or other code also writes (a page reset, an editable copy of a prop) are not reported.


Rule source: vue-doctor/reactivity/no-watch-for-computed

Released under the MIT License.