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
<script lang="ts">
// import { onMounted } from 'vue';const asyncFunction =async () => {// some async logic}exportdefaultdefineComponent({async setup() {awaitasyncFunction();onMounted(() => {// some hook logic }); }})
</script>
What did you expect to happen?
In normal case, if I import hook in setup, I get eslint error.
What actually happened?
If I import hook using unplugin-auto-import, I don't get an eslint error.
And in browser console I get
[Vue warn]: onMounted is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.
at <App>
Thank you for posting the issue.
This plugin has no way of determining if the user is autoimporting onMounted.
So not checking unknown onMounted is the intentional behavior of this rule.
Either you turn off the rule or import onMounted explicitly.
Checklist
Tell us about your environment
Please show your full configuration:
What did you do?
What did you expect to happen?
In normal case, if I import hook in setup, I get eslint error.

What actually happened?
If I import hook using

unplugin-auto-import
, I don't get an eslint error.And in browser console I get
Repository to reproduce this issue
https://github.com/basil-gor/eslint-vue-lifecycle-after-await-example
The text was updated successfully, but these errors were encountered: