vue/no-restricted-v-on
disallow specific argument in v-on.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
warning |
None | No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The button listens for the forbidden legacy-click.
<template>
<button type="button" @legacy-click="save">x</button>
</template>
Good
The button listens for click.
<template>
<button type="button" @click="save">x</button>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-restricted-v-on": "warn"
},
"ruleOptions": {
"vue/no-restricted-v-on": [
"legacy-click"
]
}
},
});
Then run vp run lint.