Appearance
vue/require-prop-type-constructor
要求 prop 类型为构造函数
- ⚙️ 此规则包含在
"plugin:vue/essential"
、*.configs["flat/essential"]
、"plugin:vue/vue2-essential"
、*.configs["flat/vue2-essential"]
、"plugin:vue/strongly-recommended"
、*.configs["flat/strongly-recommended"]
、"plugin:vue/vue2-strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/recommended"
、*.configs["flat/recommended"]
、"plugin:vue/vue2-recommended"
和*.configs["flat/vue2-recommended"]
中。
🔧命令行 上的
--fix
选项可以自动修复此规则报告的一些问题。¥🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
📖 规则详情
此规则报告不能假定为构造函数的 prop 类型。
¥This rule reports prop types that can't be presumed as constructors.
不可能捕捉到所有可能的情况并知道 prop 类型是否是构造函数,因此此规则限制了几种类型的节点,而不是允许正确的节点。
¥It's impossible to catch every possible case and know whether the prop type is a constructor or not, hence this rule restricts few types of nodes, instead of allowing correct ones.
以下类型是禁止的,将会被报告:
¥The following types are forbidden and will be reported:
字面量
¥Literal
TemplateLiteral
BinaryExpression
UpdateExpression
它将捕获最常见的使用字符串而不是构造函数的错误。
¥It will catch most commonly made mistakes which are using strings instead of constructors.
🔧选项
¥🔧 Options
无。
¥Nothing.
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v5.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v5.0.0
🔍代码实现
¥🔍 Implementation