Skip to content

Latest commit

 

History

History
70 lines (54 loc) · 1.69 KB

no-deprecated-props-default-this.md

File metadata and controls

70 lines (54 loc) · 1.69 KB
pageClass sidebarDepth title description
rule-details
0
vue/no-deprecated-props-default-this
disallow props default function `this` access

vue/no-deprecated-props-default-this

disallow props default function this access

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

📖 Rule Details

This rule reports the use of this within the props default value factory functions. In Vue.js 3.0.0+, props default value factory functions no longer have access to this.

See Migration Guide - Props Default Function this Access for more details.

<script>
export default {
  props: {
    a: String,
    b: {
      default () {
        /* ✗ BAD */
        return this.a
      }
    }
  }
}
</script>
<script>
export default {
  props: {
    a: String,
    b: {
      default (props) {
        /* ✓ GOOD */
        return props.a
      }
    }
  }
}
</script>

🔧 Options

Nothing.

📚 Further Reading

🔍 Implementation