Skip to content

Latest commit

 

History

History
80 lines (66 loc) · 1.01 KB

no-dupe-keys.md

File metadata and controls

80 lines (66 loc) · 1.01 KB

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

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 {
      dat: null
    }
  },
  methods: {
    test () {
    }
  }
}

🔧 Options

This rule has an object option:

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

Example:

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

👎 Examples of incorrect code for this configuration

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