vue/no-shadow-native-events
Disallow component events that shadow native events.
| 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 component declares click, which collides with a native event.
<script setup>
const emit = defineEmits(['click'])
</script>
<template />
Good
A component-specific activate event avoids the collision.
<script setup>
const emit = defineEmits(['activate'])
</script>
<template />
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-shadow-native-events": "warn"
}
},
});
Then run vp run lint.