Skip to content

noVueDeprecatedDeleteSet (JavaScript)

Language JavaScript (and super languages)
biome.json
{
"linter": {
"rules": {
"nursery": {
"noVueDeprecatedDeleteSet": "error"
}
}
}
}

Disallow the $set and $delete functions that Vue 3 removed.

Vue 2 could not detect when a property was added to or deleted from a reactive object, so it provided $set and $delete (also available as Vue.set and Vue.delete, or as set and del imported from vue) to make these changes visible. Vue 3 detects these changes on its own and no longer provides these functions, so calling them throws an error.

Assign the property directly to add it, and use the delete operator to remove it.

See the Vue 3 migration guide for more information.

<script>
export default {
methods: {
addName() {
this.$set(this.user, "name", "Alice");
}
}
};
</script>
code-block.vue:5:7 lint/nursery/noVueDeprecatedDeleteSet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This calls the Vue set function, which Vue 3 removed.

3 │ methods: {
4 │ addName() {
> 5 │ this.$set(this.user, "name", "Alice");
│ ^^^^^^^^^
6 │ }
7 │ }

ℹ Vue 3 detects added and deleted properties on its own, so this function no longer exists and calling it throws an error.

ℹ Assign the property directly instead, for example object.key = value.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<script>
export default {
methods: {
removeName() {
this.$delete(this.user, "name");
}
}
};
</script>
code-block.vue:5:7 lint/nursery/noVueDeprecatedDeleteSet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This calls the Vue delete function, which Vue 3 removed.

3 │ methods: {
4 │ removeName() {
> 5 │ this.$delete(this.user, "name");
│ ^^^^^^^^^^^^
6 │ }
7 │ }

ℹ Vue 3 detects added and deleted properties on its own, so this function no longer exists and calling it throws an error.

ℹ Use the delete operator instead, for example delete object.key.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

import Vue from "vue";
Vue.set(user, "name", "Alice");
code-block.js:3:1 lint/nursery/noVueDeprecatedDeleteSet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This calls the Vue set function, which Vue 3 removed.

1 │ import Vue from "vue";
2 │
> 3 │ Vue.set(user, "name", "Alice");
│ ^^^^^^^
4 │

ℹ Vue 3 detects added and deleted properties on its own, so this function no longer exists and calling it throws an error.

ℹ Assign the property directly instead, for example object.key = value.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

import { del } from "vue";
del(user, "name");
code-block.js:3:1 lint/nursery/noVueDeprecatedDeleteSet ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ This calls the Vue delete function, which Vue 3 removed.

1 │ import { del } from "vue";
2 │
> 3 │ del(user, "name");
│ ^^^
4 │

ℹ Vue 3 detects added and deleted properties on its own, so this function no longer exists and calling it throws an error.

ℹ Use the delete operator instead, for example delete object.key.

ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<script>
export default {
methods: {
addName() {
this.user.name = "Alice";
},
removeName() {
delete this.user.name;
}
}
};
</script>