Skip to content

False positives when destructuring with rename toRef props in vue/no-dupe-keys rule #2197

Closed as not planned
@N-Silbernagel

Description

@N-Silbernagel

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 8.41.0
  • eslint-plugin-vue version: 9.14.0
  • Node version: 16.14.2
  • Operating System: MacOs / StackBlitz

Please show your full configuration:

module.exports = {
  extends: [
    '@vue/typescript/recommended',
    'eslint:recommended',
    'plugin:vue/vue3-recommended',
  ],
  rules: {
    // override/add rules settings here, such as:
    // 'vue/no-unused-vars': 'error'
  },
};

What did you do?

<script setup lang="ts">
import { computed, ref, toRefs } from 'vue';

const props = defineProps<{ msg: string }>();

const { msg: msgProp } = toRefs(props);

const msg = computed(() => msgProp.value || 'hello');
</script>

This is similar to #2189 but with a renamed prop in destructuring assignment.

What did you expect to happen?
No errors.

What actually happened?

/src/components/HelloWorld.vue
8:7 error Duplicated key 'msg' vue/no-dupe-keys

✖ 1 problem (1 error, 0 warnings)

Repository to reproduce this issue

https://stackblitz.com/edit/vitejs-vite-49r5se?file=src%2Fcomponents%2FHelloWorld.vue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions