vue/no-expose-after-await Correctness
What it does
Disallow asynchronously registered expose.
Why is this bad?
defineExpose and context.expose() registered after an await expression in <script setup> or setup() may not work as expected because they are registered after the component instance has finished setting up.
Examples
Examples of incorrect code for this rule:
vue
<script setup>
await doSomething();
defineExpose({
/* ... */
}); // error
</script>Examples of correct code for this rule:
vue
<script setup>
defineExpose({
/* ... */
}); // ok
await doSomething();
</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-expose-after-await": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["vue"],
rules: {
"vue/no-expose-after-await": "error",
},
});bash
oxlint --deny vue/no-expose-after-await --vue-pluginVersion
This rule was added in vnext.
