Skip to content

toRef can pass vue/no-dupe-keys allowing duplicated reference in template #3070

@hanool

Description

@hanool

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: 10.1.0
  • eslint-plugin-vue version: 10.8.0
  • Vue version: 3.5.31
  • Node version: 24.14.1
  • Operating System: Ubuntu24.04 (on WSL2)

Please show your full configuration:
I'm using default @nuxt/eslint module

// @ts-check
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
  // Your custom configs here
)

What did you do?

<template>
  <div>
    <!-- template will have reference for both ref foo and props.foo -->
    <p>{{foo}}</p>
  </div>
</template>
<script setup>
import { ref, toRef } from "vue"
const props = defineProps(['foo'])
// const foo = ref() // this will be errored with vue/no-dupe-keys
const foo = toRef(props, 'foo') // this passes vue/no-dupe-keys, and toRef foo.
</script>

What did you expect to happen?
const foo = toRef(props, 'foo') is marked as invalidation of vue/no-dupe-keys

What actually happened?
const foo = toRef(props, 'foo') passes vue/no-dupe-keys

Repository to reproduce this issue
playground

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