eslint-plugin-vue
eslint-plugin-vue copied to clipboard
Warn on non-reactive dependencies in computed
Please describe what the rule should do:
Warn if a computed property references non-reactive VM properties, such as $slots or $refs.
What category should the rule belong to?
- [ ] Enforces code style
- [x] Warns about a potential error
- [ ] Suggests an alternate way of doing something
- [ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about: I see this mistake frequently, but doesn't actually work because slots aren't reactive.
computed: {
hasContentSlot() {
return !!this.$slots.content;
}
}
Additional context
Bumping this since it seems like it was missed
Sorry, I missed it. That rule sounds good to me :+1:
+1!
I can't count how many times I had to mention this in code reviews and give practical examples to showcase: in conditional slot rendering context, there might be an illusion of reactivity when the computed value starts truthy.