vue/no-restricted-props
disallow specific 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 component declares the forbidden third prop.
<script setup lang="ts">
defineProps<{ third?: number }>();
</script>
<template>
<p>ok</p>
</template>
Good
The component declares first.
<script setup lang="ts">
defineProps<{ first?: number }>();
</script>
<template>
<p>ok</p>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"vue/no-restricted-props": "warn"
},
"ruleOptions": {
"vue/no-restricted-props": [
"third"
]
}
},
});
Then run vp run lint.