Skip to content

Feature request: Apply ESLint to inline event handlers #2573

@henribru

Description

@henribru

Tell us about your environment

  • ESLint version: 9.12.0
  • eslint-plugin-vue version: 9.28.0
  • Vue version: 3.5.9
  • Node version: 18.17.1

The problem you want to solve.
ESLint rules don't seem to apply to the code inside inline event handlers (with the exception of what vue/v-on-handler-style checks). As an example, if I do

      @click="
        () => {
          const foo = 3;
          handleClick();
        }
      "

, I would expect no-unused-vars to trigger, but it doesn't.
If instead I do

      @click="onClick"
---
function onClick() {
  const foo = 3;
  handleClick();
}

, it obviously does. It would be nice if this was consistent.

Your take on the correct solution to problem.
Run ESLint on inline event handlers the same way as if they weren't inline.

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