- ⚙️ This rule is included in
"plugin:vue/strongly-recommended"
and"plugin:vue/recommended"
.
In committed code, prop definitions should always be as detailed as possible, specifying at least type(s).
This rule enforces that a props
statement contains type definition.
👎 Examples of incorrect code for this rule:
props: ['status']
👍 Examples of correct code for this rule:
// Without options, just type reference
props: {
status: String
}
// With options with type field
props: {
status: {
type: String,
required: true,
}
}
// With options without type field but with validator field
props: {
status: {
required: true,
validator: function (value) {
return (
value === null ||
Array.isArray(value) && value.length > 0
)
}
}
}
Nothing.