You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since $delete and $set APIs are removed in Vue 3; it would be helpful to add a warning to help people transition to Vue 3 by discouraging deprecated APIs
Global functions set and delete, and the instance methods $set and $delete. They are no longer required with proxy-based change detection.
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)
[x] Other (please specify: Vue 3 transition)
Provide 2-3 code examples that this rule should warn about:
<!-- BAD -->
this.$set(...)
Vue.set(...)
this.$delete(...)
Vue.delete(...)
<!-- BAD -->
Vue.set(col, 'value', usage[col.id]);
<!-- GOOD -->
Object.assign(col, { value: usage[col.id] });
<!-- BAD -->
this.$set(targetObj, lastKey, value);
<!-- GOOD -->
targetObj[lastKey] = value;
<!-- BAD -->
Vue.delete(targetObj, lastKey);
this.$delete(targetObj, lastKey);
<!-- GOOD -->
delete targetObj[lastKey];
Please describe what the rule should do:
Since
$delete
and$set
APIs are removed in Vue 3; it would be helpful to add a warning to help people transition to Vue 3 by discouraging deprecated APIsGlobal functions set and delete, and the instance methods $set and $delete. They are no longer required with proxy-based change detection.
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)
[x] Other (please specify: Vue 3 transition)
Provide 2-3 code examples that this rule should warn about:
<!-- BAD --> this.$set(...) Vue.set(...) this.$delete(...) Vue.delete(...)
<!-- BAD --> Vue.set(col, 'value', usage[col.id]); <!-- GOOD --> Object.assign(col, { value: usage[col.id] });
<!-- BAD --> this.$set(targetObj, lastKey, value); <!-- GOOD --> targetObj[lastKey] = value;
<!-- BAD --> Vue.delete(targetObj, lastKey); this.$delete(targetObj, lastKey); <!-- GOOD --> delete targetObj[lastKey];
Additional context
The text was updated successfully, but these errors were encountered: