JS.VUE.NO.EXPOSE.AFTER.AWAIT
Usages of `expose()` and `defineExpose()` after an `await` expression
Rule Details
This rule reports usages of expose()
and defineExpose()
after an await
expression.
In the setup()
function, expose()
should be registered synchronously.
In the <script setup>
, defineExpose()
should be registered synchronously.
{'vue/no-expose-after-await': ['error']}
Copy
<script>
export default {
async setup(props, { expose }) {
/* GOOD */
expose({/* ... */})
await doSomething()
/* BAD */
expose({/* ... */})
}
}
</script>
{'vue/no-expose-after-await': ['error']}
Copy
<script setup>
/* GOOD */
defineExpose({/* ... */})
await doSomething()
/* BAD */
defineExpose({/* ... */})
</script>
Options
Nothing.
Further Reading
- Vue RFCs - 0042-expose-api (https://github.com/vuejs/rfcs/blob/master/active-rfcs/0042-expose-api.md)
- Vue RFCs - 0013-composition-api (https://github.com/vuejs/rfcs/blob/master/active-rfcs/0013-composition-api.md)