vue/no-ref-as-operand
eslint-plugin-vue
Safe autofixRecommended
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-ref-as-operand": "error",
},
},
];Disallow use of value wrapped by ref() (Composition API) as an operand
import { ref } from "vue"
const count = ref(0)
count++import { ref } from "vue"
const ok = ref(false)
const msg = ok ? "yes" : "no"import { ref } from "vue"
const ok = ref(false)
if (ok) {
//
}import { ref } from "vue"
const count = ref(0)
count.value++import { ref } from "vue"
const ok = ref(true)
const msg = ok.value ? "yes" : "no"
if (ok.value) {
//
}import { ref } from "vue"
export default {
setup(_props, { emit }) {
const count = ref(0)
emit('increment', count.value)
}
}Examples from the Biome documentation.
vue/no-ref-as-operand
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-ref-as-operand": "error",
},
},
];Oxlint does not have this rule.
correctness/noVueRefAsOperand
correctness · since 2.4.5
{
"linter": {
"rules": {
"correctness": {
"noVueRefAsOperand": "error"
}
}
}
}Disallow duplicate conditions in v-if / v-else-if chains
Disallow using v-if on the same element as v-for