vue/v-on-handler-style
eslint-plugin-vue
Safe autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/v-on-handler-style": "error",
},
},
]; <button v-on:click="handler()" />
<button v-on:click="() => handler()" />
</template> <button v-on:click="handler()" />
<button v-on:click="count++" />
<button v-on:click="() => handler()" />
<button v-on:click="() => count++" />
<button v-on:click="(a, b) => handler(a, b)" />
<template v-for="e in list">
<button v-on:click="e()" />
<button v-on:click="() => e()" />
<button v-on:click="handler(e)" />
</template>
</template> <button v-on:click="handler()" />
<button v-on:click="count++" />
<button v-on:click="() => handler()" />
<button v-on:click="() => count++" />
<button v-on:click="(a, b) => handler(a, b)" />
<template v-for="e in list">
<button v-on:click="e()" />
<button v-on:click="() => e()" />
<button v-on:click="() => handler(e)" />
</template>
</template><button v-on:click="handler" /><button v-on:click="handler" />
<template v-for="e in list">
<button v-on:click="e" />
<button v-on:click="() => handler(e)" />
</template><button v-on:click="handler" />
<template v-for="e in list">
<button v-on:click="e" />
<button v-on:click="handler(e)" />
</template>Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
vue/v-on-handler-style
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/v-on-handler-style": "error",
},
},
];Oxlint does not have this rule.
nursery/useVueConsistentVOnHandlerStyle
nursery · since 2.6.8
{
"linter": {
"rules": {
"nursery": {
"useVueConsistentVOnHandlerStyle": "error"
}
}
}
}Enforce adding type declarations to object props