Skip to content

Latest commit

 

History

History
70 lines (55 loc) · 1.71 KB

return-in-emits-validator.md

File metadata and controls

70 lines (55 loc) · 1.71 KB
pageClass sidebarDepth title description since
rule-details
0
vue/return-in-emits-validator
enforce that a return statement is present in emits validator
v7.0.0

vue/return-in-emits-validator

enforce that a return statement is present in emits validator

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

📖 Rule Details

This rule enforces that a return statement is present in emits validators.

<script>
export default {
  emits: {
    /* ✓ GOOD */
    foo (evt) {
      if (evt) {
        return true
      } else {
        return false
      }
    },
    bar: function () {
      return true
    },
    baz (evt) {
      if (evt) {
        return true
      }
    },
    /* ✗ BAD */
    qux: function () {},
    quux (evt) {
      if (!evt) {
        return false
      }
    }
  }
}
</script>

🔧 Options

Nothing.

📚 Further Reading

🚀 Version

This rule was introduced in eslint-plugin-vue v7.0.0

🔍 Implementation