Vize

vue/v-on-handler-style

Enforce writing v-on handlers as a method reference or an inline function.

Default severity Presets Automatic fix Options
warning nuxt, opinionated No None

Applies to: Vue SFC templates and blocks, with script context where the rule requires it.

Bad

The handlers put mutations and multiple statements directly in the event attribute.

<template>
<button @click="count++"></button>
<button @click="doThis(); doThat()"></button>
<button @click="foo = bar"></button>
</template>

Good

Use a handler reference, or an arrow/function expression when inline logic is needed. The function boundary makes the handler form explicit.

<template>
<button @click="handler"></button>
<button @click="foo.bar"></button>
<button @click="() => count++"></button>
<button @click="function () { count++ }"></button>
</template>

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/v-on-handler-style": "warn"
    }
  },
});

Then run vp run lint.