vue/no-deprecated-v-on-number-modifiers
Disallow deprecated numeric keyCode modifiers on v-on.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
error |
essential, happy-path, nuxt, ecosystem, opinionated |
Yes | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Numeric selection and fixes
The first decimal-prefix numeric modifier determines the finding. @keyup.13.27="submit" reports only 13 and offers @keyup.enter.27="submit"; another fix pass can replace 27 with escape. @keyup.13suffix="submit" also becomes @keyup.enter="submit". Values 0–9 are exempt, so @keyup.0.13="submit" is clean under this rule. Unknown values such as 999 report without a fix. The existing Vue 2 and petite-vue exemption remains in effect.
Bad
The keyboard handlers identify keys by the removed numeric codes 13 and 27.
<template>
<input @keyup.13="submit" />
<input v-on:keyup.27="cancel" />
<input @keyup.13.stop="submit" />
</template>
Good
The handlers use the named enter and esc key modifiers.
<template>
<input @keyup.enter="submit" />
<input @keyup.esc="cancel" />
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-deprecated-v-on-number-modifiers": "error"
}
},
});
Then run vp run lint.