vue/no-props-shadow
Disallow setup declarations that shadow props.
| 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 local value declaration shadows the prop.
<script setup>
defineProps({ value: String })
const value = "local"
</script>
<template />
Good
The local binding has a distinct name.
<script setup>
defineProps({ value: String })
const localValue = "local"
</script>
<template />
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-props-shadow": "warn"
}
},
});
Then run vp run lint.