Skip to content

Apply linting rules to composables as well #2715

Open
@Bart-Westenenk

Description

@Bart-Westenenk

Tell us about your environment

  • ESLint version: v9.22.0
  • eslint-plugin-vue version: 10.0.0
  • Vue version: 3.5.13
  • Node version: v22.14.0

The problem you want to solve.
Many composables, from simple to advanced, use some kind of Vue functionality like computed properties, refs, hooks, watchers etc. (I propably forgot something). These composables are not linted, so for example when a computed property has a side effect, the vue/no-side-effects-in-computed-properties is not triggered while it very much can be triggered.

Your take on the correct solution to problem.
I think there are multiple solutions:

  1. Detect composables by the use of Vue functionality like triggering watchers, using hooks, returning computed properties etc. This also allows for more composable specific rules and has more potential, but more work.
  2. Make the plugin also trigger on .ts files containing Vue composables.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions