---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: noVueDuplicateKeys
description: Learn more about noVueDuplicateKeys
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="JavaScript (and super languages)" icon="seti:javascript">
:::caution
This rule is part of the [nursery](/linter/#nursery) group. This means that it is experimental and the behavior can change at any time.
:::
## Summary
- Rule available since: `v2.2.5`
- Diagnostic Category: [`lint/nursery/noVueDuplicateKeys`](/reference/diagnostics#diagnostic-category)
- This rule doesn't have a fix.
- The default severity of this rule is [**error**](/reference/diagnostics#error).
- This rule belongs to the following domains:
  - [`vue`](/linter/domains#vue)
- Sources: 
  - Same as [`vue/no-dupe-keys`](https://eslint.vuejs.org/rules/no-dupe-keys)

## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"nursery": {
				"noVueDuplicateKeys": "error"
			}
		}
	}
}

```
## Description
Disallow duplicate keys in Vue component data, methods, computed properties, and other options.

This rule prevents the use of duplicate keys across different Vue component options
such as `props`, `data`, `computed`, `methods`, and `setup`. Even if keys don't conflict
in the script tag, they may cause issues in the template since Vue allows direct
access to these keys.

## Examples

### Invalid

```vue
<script>
export default {
    props: ['foo'],
    data() {
        return {
            foo: 'bar'
        };
    }
};
</script>
```

<pre class="language-text"><code class="language-text">code-block.vue:2:13 <a href="https://biomejs.dev/linter/rules/no-vue-duplicate-keys">lint/nursery/noVueDuplicateKeys</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Duplicate key </span><span style="color: Tomato;"><strong>foo</strong></span><span style="color: Tomato;"> found in Vue component.</span><br />  <br />    <strong>1 │ </strong>export default &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>2 │ </strong>    props: ['foo'],<br />   <strong>   │ </strong>            <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>3 │ </strong>    data() &#123;<br />    <strong>4 │ </strong>        return &#123;<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Key </span><span style="color: lightgreen;"><strong>foo</strong></span><span style="color: lightgreen;"> is also defined here.</span><br />  <br />    <strong>3 │ </strong>    data() &#123;<br />    <strong>4 │ </strong>        return &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>5 │ </strong>            foo: 'bar'<br />   <strong>   │ </strong>            <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>6 │ </strong>        &#125;;<br />    <strong>7 │ </strong>    &#125;<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Keys defined in different Vue component options (props, data, methods, computed) can conflict when accessed in the template. Rename the key to avoid conflicts.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit </span><span style="color: lightgreen;"><a href="https://biomejs.dev/linter/#nursery">https://biomejs.dev/linter/#nursery</a></span><span style="color: lightgreen;"> for more information.</span><br />  <br /></code></pre>

```vue
<script>
export default {
    data() {
        return {
            message: 'hello'
        };
    },
    methods: {
        message() {
            console.log('duplicate key');
        }
    }
};
</script>
```

<pre class="language-text"><code class="language-text">code-block.vue:4:13 <a href="https://biomejs.dev/linter/rules/no-vue-duplicate-keys">lint/nursery/noVueDuplicateKeys</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Duplicate key </span><span style="color: Tomato;"><strong>message</strong></span><span style="color: Tomato;"> found in Vue component.</span><br />  <br />    <strong>2 │ </strong>    data() &#123;<br />    <strong>3 │ </strong>        return &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>4 │ </strong>            message: 'hello'<br />   <strong>   │ </strong>            <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>5 │ </strong>        &#125;;<br />    <strong>6 │ </strong>    &#125;,<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Key </span><span style="color: lightgreen;"><strong>message</strong></span><span style="color: lightgreen;"> is also defined here.</span><br />  <br />     <strong>6 │ </strong>    &#125;,<br />     <strong>7 │ </strong>    methods: &#123;<br />   <strong><span style="color: Tomato;">&gt;</span></strong> <strong>8 │ </strong>        message() &#123;<br />    <strong>   │ </strong>        <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />     <strong>9 │ </strong>            console.log('duplicate key');<br />    <strong>10 │ </strong>        &#125;<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Keys defined in different Vue component options (props, data, methods, computed) can conflict when accessed in the template. Rename the key to avoid conflicts.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit </span><span style="color: lightgreen;"><a href="https://biomejs.dev/linter/#nursery">https://biomejs.dev/linter/#nursery</a></span><span style="color: lightgreen;"> for more information.</span><br />  <br /></code></pre>

```vue
<script>
export default {
    computed: {
        count() {
            return this.value * 2;
        }
    },
    methods: {
        count() {
            this.value++;
        }
    }
};
</script>
```

<pre class="language-text"><code class="language-text">code-block.vue:3:9 <a href="https://biomejs.dev/linter/rules/no-vue-duplicate-keys">lint/nursery/noVueDuplicateKeys</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Duplicate key </span><span style="color: Tomato;"><strong>count</strong></span><span style="color: Tomato;"> found in Vue component.</span><br />  <br />    <strong>1 │ </strong>export default &#123;<br />    <strong>2 │ </strong>    computed: &#123;<br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>3 │ </strong>        count() &#123;<br />   <strong>   │ </strong>        <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>4 │ </strong>            return this.value &#42; 2;<br />    <strong>5 │ </strong>        &#125;<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Key </span><span style="color: lightgreen;"><strong>count</strong></span><span style="color: lightgreen;"> is also defined here.</span><br />  <br />     <strong>6 │ </strong>    &#125;,<br />     <strong>7 │ </strong>    methods: &#123;<br />   <strong><span style="color: Tomato;">&gt;</span></strong> <strong>8 │ </strong>        count() &#123;<br />    <strong>   │ </strong>        <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />     <strong>9 │ </strong>            this.value++;<br />    <strong>10 │ </strong>        &#125;<br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Keys defined in different Vue component options (props, data, methods, computed) can conflict when accessed in the template. Rename the key to avoid conflicts.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit </span><span style="color: lightgreen;"><a href="https://biomejs.dev/linter/#nursery">https://biomejs.dev/linter/#nursery</a></span><span style="color: lightgreen;"> for more information.</span><br />  <br /></code></pre>

### Valid

```vue
<script>
export default {
    props: ['foo'],
    data() {
        return {
            bar: 'baz'
        };
    },
    methods: {
        handleClick() {
            console.log('unique key');
        }
    }
};
</script>
```

```vue
<script>
export default {
    computed: {
        displayMessage() {
            return this.message.toUpperCase();
        }
    },
    methods: {
        clearMessage() {
            this.message = '';
        }
    }
};
</script>
```

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/src/lint/nursery/no_vue_duplicate_keys.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_js_analyze/tests/specs/nursery/noVueDuplicateKeys)

</TabItem>
</Tabs>