Skip to content

Latest commit

 

History

History
76 lines (61 loc) · 1.1 KB

no-dupe-keys.md

File metadata and controls

76 lines (61 loc) · 1.1 KB

disallow duplication of field names (vue/no-dupe-keys)

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

This rule prevents to use duplicated names.

📖 Rule Details

This rule is aimed at preventing duplicated property names.

👎 Examples of incorrect code for this rule:

export default {
  props: {
    foo: String
  },
  computed: {
    foo: {
      get () {}
    }
  },
  data: {
    foo: null
  },
  methods: {
    foo () {}
  }
}

👍 Examples of correct code for this rule:

export default {
  props: ['foo'],
  computed: {
    bar () {}
  },
  data () {
    return {
      baz: null
    }
  },
  methods: {
    boo () {}
  }
}

🔧 Options

This rule has an object option:

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

Example:

"vue/no-dupe-keys": [2, {
  groups: ["firebase"]
}]

👎 Examples of incorrect code for this configuration

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