Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make vue/no-ref-as-operand also consider computed #2114

Closed
DanSnow opened this issue Mar 26, 2023 · 4 comments
Closed

Make vue/no-ref-as-operand also consider computed #2114

DanSnow opened this issue Mar 26, 2023 · 4 comments

Comments

@DanSnow
Copy link

DanSnow commented Mar 26, 2023

What rule do you want to change?
vue/no-ref-as-operand

Does this change cause the rule to produce more or fewer warnings?
more warning

How will the change be implemented? (New option, new default behavior, etc.)?
Make vue/no-ref-as-operand also consider computed

Please provide some example code that this change will affect:

const count = ref(0)
const isEven = computed(() => count.value % 2 === 0)

watchEffect(() => {
  // warning at here
  if (isEven) {
    console.log('is even')
  }
})

What does the rule currently do for this code?
no warning

What will the rule do after it's changed?
Warning about incorrect usage for computed

Additional context

@DanSnow
Copy link
Author

DanSnow commented Mar 26, 2023

I tried it again. We didn't see a warning because we use unplugin-auto-import.

I tried on the document's interactive demo

without import => no warning
image

with import => has warning
image

@ota-meshi
Copy link
Member

ota-meshi commented Mar 26, 2023

Duplicate of #1969
Follow #1969.

@DanSnow
Copy link
Author

DanSnow commented Mar 26, 2023

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants