Skip to content

Latest commit

 

History

History
90 lines (72 loc) · 1.96 KB

no-undef-properties.md

File metadata and controls

90 lines (72 loc) · 1.96 KB
pageClass sidebarDepth title description
rule-details
0
vue/no-undef-properties
disallow undefined properties

vue/no-undef-properties

disallow undefined properties

  • This rule has not been released yet.

📖 Rule Details

This rule warns of using undefined properties.
This rule can help you locate potential errors resulting from misspellings property names, and implicitly added properties.

::: warning Note This rule cannot detect properties defined in other files or components. :::

<template>
  <!-- ✓ GOOD -->
  <div>{{ name }}: {{ count }}</div>
  <!-- ✗ BAD -->
  <div>{{ label }}: {{ cnt }}</div>
</template>
<script>
  export default {
    props: ['name'],
    data () {
      return {
        count: 0
      }
    },
    methods: {
      click() {
        /* ✓ GOOD */
        this.count++

        /* ✗ BAD */
        this.cnt++
      }
    }
  }
</script>

🔧 Options

{
  "vue/no-undef-properties": ["error", {
    "ignores": ["/^\\$/"]
  }]
}
  • ignores (string[]) ... An array of property names or patterns that have already been defined property, or property to ignore from the check. Default is ["/^\\$/"].

"ignores": ["/^\\$/"] (default)

<template>
  <!-- ✓ GOOD -->
  <div>{{ $t('foo') }}</div>
</template>
<script>
  export default {
    mounted() {
      /* ✓ GOOD */
      const hash = this.$route.hash
    }
  }
</script>

🔍 Implementation