vue/no-restricted-v-on
eslint-plugin-vue
No autofix
eslint.config.js
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-restricted-v-on": "error",
},
},
]; <div v-on:foo="x" />
<div @bar-baz="x" />
</template> <div @foo.prevent="x" />
</template> <MyButton @foo="x" />
</template><div v-on:click="x" />
<div @tap="x" /><div @foo="x" /><CoolButton @foo="x" />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/no-restricted-v-on
eslint-plugin-vue
import vue from "eslint-plugin-vue";
export default [
{
plugins: { vue },
rules: {
"vue/no-restricted-v-on": "error",
},
},
];Oxlint does not have this rule.
nursery/noVueRestrictedVOn
nursery · since 2.6.5
{
"linter": {
"rules": {
"nursery": {
"noVueRestrictedVOn": "error"
}
}
}
}Disallow usages that lose the reactivity of props passed to setup
Disallow asynchronously called restricted methods
Disallow the use of event names that collide with native web event names
Disallow usages of ref objects that can lead to loss of reactivity
Disallow target="_blank" attribute without rel="noopener noreferrer"