# vue/no-restricted-call-after-await

disallow asynchronously called restricted methods

# 📖 Rule Details

This rule reports your restricted calls after the await expression. In setup() function, you need to call your restricted functions synchronously.

# 🔧 Options

This rule takes a list of objects, where each object specifies a restricted module name and an exported name:

{
  "vue/no-restricted-call-after-await": ["error",
    { "module": "vue-i18n", "path": "useI18n" },
    { ... } // You can specify more...
  ]
}
<script> import { useI18n } from 'vue-i18n' export default { async setup() { /* ✓ GOOD */ useI18n({}) await doSomething() /* ✗ BAD */ useI18n({}) } } </script>
Now loading...

The following properties can be specified for the object.

  • module ... Specify the module name.
  • path ... Specify the imported name or the path that points to the method.
  • message ... Specify an optional custom message.

For examples:

{
  "vue/no-restricted-call-after-await": ["error",
    { "module": "a", "path": "foo" },
    { "module": "b", "path": ["bar", "baz"] },
    { "module": "c" }, // Checks the default import.
    { "module": "d", "path": "default" }, // Checks the default import.
  ]
}
<script> import { foo as fooOfA } from 'a' import { bar as barOfB } from 'b' import defaultOfC from 'c' import defaultOfD from 'd' export default { async setup() { await doSomething() /* ✗ BAD */ fooOfA() barOfB.baz() defaultOfC() defaultOfD() } } </script>
Now loading...

# 🚀 Version

This rule was introduced in eslint-plugin-vue v7.4.0

# 🔍 Implementation

Last Updated: 12/27/2020, 11:25:44 PM