vue/no-restricted-props
禁止使用特定 props
- 💡 此规则报告的一些问题可以通过编辑器 建议 手动修复。
📖 规则详情
此规则允许您指定您不想在应用程序中使用的 props。
🔧 选项
此规则接受字符串列表,其中每个字符串都是要限制的 prop 名称或模式
json
{
"vue/no-restricted-props": ["error", "value", "/^forbidden/"]
}
或者,该规则也接受对象。
json
{
"vue/no-restricted-props": ["error",
{
"name": "value",
"message": "If you intend a prop for v-model, it should be 'modelValue' in Vue 3.",
"suggest": "modelValue"
},
]
}
可以为对象指定以下属性。
name
... 指定 prop 名称或模式。message
... 指定可选的自定义消息。suggest
... 指定可选的名称以建议更改。
🚀 版本
此规则是在 eslint-plugin-vue v7.3.0 中引入的