eslint-plugin-vue
eslint-plugin-vue copied to clipboard
Feature request: Apply ESLint to inline event handlers
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