vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.48k stars 665 forks source link

`vue/no-ref-as-operand` not catching `computed` refs #2454

Open chetan opened 7 months ago

chetan commented 7 months ago

Checklist

Tell us about your environment

What did you do?

    const count = ref(0)
    const ok = ref(true)

    const notok = computed(() => !ok.value)
    if (notok || !ok) {
      console.log("not ok!!")
    }

What did you expect to happen?

notok should be flagged as a problem in the condition above.

What actually happened?

Only !ok is flagged.

It's happening in my local env but I am able to reproduce in the web docs:

Screenshot 2024-04-22 at 11 38 42 AM

Repository to reproduce this issue

can provide more info on my local configs if needed.

waynzh commented 5 days ago

For the error in the screenshot, you need to also import computed from vue. image

If you still have this issue, please provide more information to help us debug.