eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

Fix no-ref-as-operand and allow lint when ref as right operator

Open lakb248 opened this issue 2 years ago • 2 comments

fix #2271

lakb248 avatar Aug 11 '23 07:08 lakb248

Thanks for this PR. However, I think that this PR change has caused false positives in the following usages.

<script setup lang="ts">
import { ref, Ref } from 'vue'
const refValue1: Ref<number>  = ref(0)
const maybeRefValue: Ref<number> | null = getMaybeRef()
const refValue2 = maybeRefValue || refValue1
console.log(refValue2.value)
</script>

I think we should keep track of how the result of the expression is used. Also, I think the ternary operator could be improved if it would be possible to track the usage of the result of the expression.

ota-meshi avatar Aug 14 '23 00:08 ota-meshi