<script setup lang="ts">
// this is called from other parts in the code with parameters
function myHandler (
a?: string,
b?: string,
c?: string
) {
// business logic here
console.log(a, b, c)
}
// this is called from another part of the template
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function myBusinessLogic () {
myHandler('a', 'b', 'c')
}
</script>
<template>
<!-- this looks like the documentation
✓ GOOD
<button v-on:click="handler" />
<template v-for="e in list">
<button v-on:click="e" />
<button v-on:click="() => handler(e)" />
</template>
-->
<button
@click="() => myHandler(undefined, undefined, undefined)"
/>
</template>
What did you expect to happen?
The documentation for ["method", "inline-function"] seems to allow handlers of type @click="() => myHandler(parameter)" but in this case it doesnt seem that this is resprected correctly
What actually happened?
~/repositories/eslint9test
npx eslint src/App.vue
/Users/aurora/eslint9test/src/App.vue
31:13 error Prefer method handler over inline function in v-on vue/v-on-handler-style
✖ 1 problem (1 error, 0 warnings)
Checklist
Tell us about your environment
Please show your full configuration:
Output from npx eslint --print-config eslint.config.mjs:
What did you do?
What did you expect to happen? The documentation for
["method", "inline-function"]
seems to allow handlers of type@click="() => myHandler(parameter)"
but in this case it doesnt seem that this is resprected correctlyWhat actually happened?
Repository to reproduce this issue
https://github.com/chrisnruud/eslint9test