Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 799 Bytes

return-in-computed-property.md

File metadata and controls

44 lines (35 loc) · 799 Bytes

Enforces that a return statement is present in computed property (return-in-computed-property)

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