Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Apply ESLint to inline event handlers #2573

Open
henribru opened this issue Oct 14, 2024 · 0 comments
Open

Feature request: Apply ESLint to inline event handlers #2573

henribru opened this issue Oct 14, 2024 · 0 comments

Comments

@henribru
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant