Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 1.21 KB

no-reserved-keys.md

File metadata and controls

62 lines (47 loc) · 1.21 KB

disallow overwriting reserved keys (vue/no-reserved-keys)

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

This rule prevents to use reserved names to avoid conflicts and unexpected behavior.

Rule Details

👎 Examples of incorrect code for this rule:

export default {
  props: {
    $el: String
  },
  computed: {
    $on: {
      get () {}
    }
  },
  data: {
    _foo: null
  },
  methods: {
    $nextTick () {}
  }
}

🔧 Options

This rule has an object option:

"reserved": [] (default) array of additional restricted attributes inside groups.

"groups": [] (default) array of additional group names to search for duplicates in.

Example:

"vue/no-reserved-keys": [2, {
  reserved: ['foo', 'foo2'],
  groups: ['firebase']
}]

👎 Examples of incorrect code for this configuration

export default {
  computed: {
    foo () {}
  },
  firebase: {
    foo2 () {}
  }
}

Related links