Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 946 Bytes

return-in-computed-property.md

File metadata and controls

46 lines (36 loc) · 946 Bytes

enforce that a return statement is present in computed property (vue/return-in-computed-property)

  • ⚙️ This rule is included in all of "plugin:vue/essential", "plugin:vue/strongly-recommended" and "plugin:vue/recommended".

📖 Rule Details

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
    }
  }
}

🔧 Options

This rule has an object option:

  • "treatUndefinedAsUnspecified": true (default) disallows implicitly returning undefined with a return; statement.
{
  "vue/return-in-computed-property": [2, {
    "treatUndefinedAsUnspecified": true
  }]
}