Vue option should be defined with a valid type
- VUE_MISMATCHED_TYPE_OF_OPTION
- Error
- Medium
- vue
This rule applies when Vue options are defined with invalid types.
If Vue options are defined with invalid types, their meanings are ignored, and Vue outputs a warning message.
For example, the data
option of a Vue component cannot be defined as an object. Instead, a function that returns the object should be used.
Noncompliant Code Example
View with compliant examples side by side<script>
export default {
props: [{ // VUE_MISMATCHED_TYPE_OF_OPTION alarm
foo: String
}],
data: { // VUE_MISMATCHED_TYPE_OF_OPTION alarm
bar: 'hi'
}
}
</script>
Compliant Code Example
View with noncompliant examples side by side<script>
export default {
props: {
foo: String
},
data() {
return { bar: 'hi' };
}
}
</script>
Version
This rule was introduced in DeepScan 1.15.0-beta.
See
[Vue warn]: props must be strings when using array syntax.
[Vue warn]: The data option must be a function. Plain object usage is no longer supported.