JS.VUE.NO.LIFECYCLE.AFTER.AWAIT
Disallow asynchronously registered lifecycle hooks
Rule Details
This rule reports the lifecycle hooks after await
expression.
In setup()
function, onXXX
lifecycle hooks should be registered synchronously.
{'vue/no-lifecycle-after-await': ['error']}
Copy
<script>
import { onMounted } from 'vue'
export default {
async setup() {
/* GOOD */
onMounted(() => { /* ... */ })
await doSomething()
/* BAD */
onMounted(() => { /* ... */ })
}
}
</script>
Options
Nothing.
Further Reading
- Guide - Composition API - Lifecycle Hooks (https://v3.vuejs.org/guide/composition-api-lifecycle-hooks.html)
- Vue RFCs - 0013-composition-api (https://github.com/vuejs/rfcs/blob/master/active-rfcs/0013-composition-api.md)