@scayle/eslint-plugin-vue-composable

Rules to avoid unpleasant composable problems
207,394 4
Install
npm install @scayle/eslint-plugin-vue-composable
Latest Version:1.2.1
License:MIT
Last Updated:Apr 10, 2026
Links: GitHub  ·  npm
Maintainer: hector_gonzalez_ay

@scayle/eslint-plugin-vue-composable

Why use this plugin?

When writing Vue 3 composables with async operations, it's easy to accidentally lose the component context after an await statement. This happens because the current instance is tracked and can become undefined after asynchronous operations.

For example, this code has a subtle bug:

export const useExample = async () => {
  const data = await fetchData()

  // ❌ This can cause errors because component context might be lost
  const count = ref(0)
  onMounted(() => {
    console.log('mounted')
  })

  return { count }
}

This ESLint plugin catches these issues at development time, preventing runtime errors and reactivity bugs that are difficult to debug in production.

Installation

You'll need to install ESLint along with this package:

# Using pnpm
pnpm add --dev eslint @scayle/eslint-plugin-vue-composable

# Using yarn
yarn add --dev eslint @scayle/eslint-plugin-vue-composable

# Using npm
npm install --save-dev eslint @scayle/eslint-plugin-vue-composable

Usage

Use the plugin with ESLint flat config (e.g. eslint.config.mjs). Import the plugin and add it to your config:

import vueComposable from '@scayle/eslint-plugin-vue-composable'

export default [
  {
    plugins: {
      '@scayle/vue-composable': vueComposable,
    },
    rules: {
      '@scayle/vue-composable/no-composable-after-await': 'warn',
      '@scayle/vue-composable/no-lifecycle-after-await': 'error',
      '@scayle/vue-composable/no-watch-after-await': 'error',
      '@scayle/vue-composable/no-computed-after-await': 'error',
    },
  },
]

Rules

Name                               Description
no-composable-after-await disallow asynchronously called composable functions in composables
no-computed-after-await disallow asynchronously registered computed in composables
no-lifecycle-after-await disallow asynchronously registered lifecycle hooks in composables
no-watch-after-await disallow asynchronously registered watch and watchEffect in composables
require-explicit-fallthrough-attrs require multi-root components to handle fallthrough attributes explicitly

License

Licensed under the MIT License

What is SCAYLE?

SCAYLE is a full-featured e-commerce software solution that comes with flexible APIs. Within SCAYLE, you can manage all aspects of your shop, such as products, stocks, customers, and transactions.

Learn more about SCAYLE’s architecture and commerce modules in the Docs.

Other channels

Related Packages

eslint-plugin-vue-storefront

ESLint rules for Vue Storefront

39,292
@component-hook/eslint-plugin

ESLint config for component hook

8,834 4
@cloudflight/eslint-plugin-vue

Cloudflight eslint-plugin & eslint-config for vue

38,060
eslint-plugin-test-id

This checks is data-test-id prop is present, on some tags which are useful for e...

10,384 17
eslint-plugin-vueunused

a eslint plugin for detecting unused code in vue single file component

939

Version History

Version Released License
1.2.1 MIT
1.2.0 MIT
1.1.0 MIT
1.0.0 MIT
0.2.3 MIT