-
-
Notifications
You must be signed in to change notification settings - Fork 694
Open
@Armaldio
Description
Please describe what the rule should do:
The rule should warn when trying to set a writable computed ref nested property.
What category should the rule belong to?
- Enforces code style (layout)
- Warns about a potential error (problem)
- Suggests an alternate way of doing something (suggestion)
- Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
import Vue from 'vue' import { defineComponent, ref, computed } from '@vue/composition-api' export default defineComponent({ setup(props, { root }) { const value = ref('French') const language = computed({ get() { return { selected: value.value } }, set({ selected }) { value.value = selected } }) console.log(value) // French console.log(language) // { selected: 'French' } // Good language.value = { selected: 'English' } // Bad, it has no effect unlike a standard ref language.value.selected = 'German' return { language } } )}
Additional context
With writable computed ref, it's easy to fall into this case since IDE suggestion will show nested properties.