vue/no-ref-object-reactivity-loss
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-ref-object-reactivity-loss": "error",
},
},
];Disallow usages of ref objects that can lead to loss of reactivity
import { ref } from "vue";
const count = ref(0);
const doubled = count.value * 2;import { ref } from "vue";
const count = ref(0);
const { value } = count;import { toRefs } from "vue";
const { title } = toRefs(props);
console.log(title.value);import { computed, ref, watch } from "vue";
const count = ref(0);
const doubled = computed(() => count.value * 2);
watch(count, () => {
console.log(count.value);
});
function increment() {
count.value++;
}
count.value = 10;Examples from the Biome documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/no-ref-object-reactivity-loss
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-ref-object-reactivity-loss": "error",
},
},
];Oxlint does not have this rule.
nursery/noVueRefObjectReactivityLoss
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noVueRefObjectReactivityLoss": "error"
}
}
}
}Disallow asynchronously called restricted methods
Disallow passing multiple objects in an array to class