Skip to content

vue/no-expose-after-await

disallow asynchronously registered expose

  • ⚙️ This rule is included in all of "plugin:vue/essential", *.configs["flat/essential"], "plugin:vue/strongly-recommended", *.configs["flat/strongly-recommended"], "plugin:vue/recommended" and *.configs["flat/recommended"].

📖 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.

<script> export default { async setup(props, { expose }) { /* ✓ GOOD */ expose({/* ... */}) await doSomething() /* ✗ BAD */ expose({/* ... */}) } } </script>
Now loading...
<script setup> /* ✓ GOOD */ defineExpose({/* ... */}) await doSomething() /* ✗ BAD */ defineExpose({/* ... */}) </script>
Now loading...

🔧 Options

Nothing.

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v8.1.0

🔍 Implementation