- ⚙️ This rule is included in all of
"plugin:vue/essential"
,"plugin:vue/strongly-recommended"
and"plugin:vue/recommended"
.
This rule enforces that a return
statement is present in computed
properties.
👎 Examples of incorrect code for this rule:
export default {
computed: {
foo () {},
bar: function () {}
}
}
👍 Examples of correct code for this rule:
export default {
computed: {
foo () {
return true
},
bar: function () {
return false
}
}
}
This rule has an object option:
"treatUndefinedAsUnspecified"
:true
(default) disallows implicitly returning undefined with areturn;
statement.
{
"vue/return-in-computed-property": [2, {
"treatUndefinedAsUnspecified": true
}]
}