Skip to content
← Back to rules

vue/no-deprecated-destroyed-lifecycle Correctness

🛠️ An auto-fix is available for this rule.

What it does ​

Disallow using deprecated destroyed and beforeDestroy lifecycle hooks in Vue.js 3.0.0+.

Why is this bad? ​

In Vue.js 3.0.0+, the destroyed and beforeDestroy lifecycle hooks have been renamed to unmounted and beforeUnmount respectively. Using the old names is deprecated and may cause confusion or compatibility issues.

Examples ​

Examples of incorrect code for this rule:

vue
<script>
export default {
  beforeDestroy() {},
  destroyed() {},
};
</script>

Examples of correct code for this rule:

vue
<script>
export default {
  beforeUnmount() {},
  unmounted() {},
};
</script>

How to use ​

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["vue"],
  "rules": {
    "vue/no-deprecated-destroyed-lifecycle": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["vue"],
  rules: {
    "vue/no-deprecated-destroyed-lifecycle": "error",
  },
});
bash
oxlint --deny vue/no-deprecated-destroyed-lifecycle --vue-plugin

Version ​

This rule was added in v1.35.0.

References ​