Skip to content

useTemplateRef 'xxx' is defined as ref, but never used.eslintvue/no-unused-refs #2559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fxzer opened this issue Sep 16, 2024 · 1 comment
Closed

Comments

@fxzer
Copy link

fxzer commented Sep 16, 2024

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: ^9.10.0
  • eslint-plugin-vue version: 9.28.0
  • Vue version: ^3.5.6
  • Node version: v20.14.0
  • Operating System: MacOS 14.6.1

Please show your full configuration:

{
  "name": "wukong-gamemap",
  "type": "module",
  "private": true,
  "packageManager": "[email protected]",
  "description": "黑神话悟空·游戏地图(仿写游民星空)",
  "scripts": {
    "build": "vite build",
    "dev": "vite --port 3333 --open",
    "lint": "eslint .",
    "lintf": "eslint --fix .",
    "typecheck": "vue-tsc --noEmit",
    "preview": "vite preview",
    "up": "taze major -I",
    "postinstall": "npx simple-git-hooks"
  },
  "dependencies": {
    "@vueuse/core": "^11.1.0",
    "axios": "^1.7.7",
    "ejs": "^3.1.10",
    "leaflet": "^1.9.4",
    "pinia": "^2.2.2",
    "pinia-plugin-persistedstate": "^4.0.1",
    "vue": "^3.5.6"
  },
  "devDependencies": {
    "@antfu/eslint-config": "^3.6.2",
    "@iconify-json/carbon": "^1.2.1",
    "@types/ejs": "^3.1.5",
    "@types/leaflet": "^1.9.12",
    "@types/mockjs": "^1.0.10",
    "@types/node": "^22.5.5",
    "@unocss/eslint-config": "^0.62.4",
    "@unocss/eslint-plugin": "^0.62.4",
    "@unocss/reset": "^0.62.4",
    "@vitejs/plugin-vue": "^5.1.3",
    "@vue-macros/volar": "^0.30.2",
    "@vue/test-utils": "^2.4.6",
    "eslint": "^9.10.0",
    "eslint-plugin-format": "^0.1.2",
    "jsdom": "^25.0.0",
    "lint-staged": "^15.2.10",
    "mockjs": "^1.1.0",
    "pnpm": "^9.10.0",
    "simple-git-hooks": "^2.11.1",
    "taze": "^0.16.9",
    "typescript": "^5.6.2",
    "unocss": "^0.62.4",
    "unplugin-auto-import": "^0.18.3",
    "unplugin-vue-components": "^0.27.4",
    "unplugin-vue-macros": "^2.12.2",
    "vite": "^5.4.5",
    "vite-plugin-vue-devtools": "^7.4.5",
    "vue-tsc": "^2.1.6"
  },
  "simple-git-hooks": {
    "pre-commit": "pnpm lint-staged"
  },
  "lint-staged": {
    "*": "eslint --fix"
  }
}

What did you do?

<script setup lang='ts'>
// const map = useTemplateRef<HTMLElement>('map') ✅
const mapRef = useTemplateRef<HTMLElement>('map') // ❌ 'map' is defined as ref, but never used.eslintvue/no-unused-refs
// const map = ref<HTMLElement | null>(null) // ✅
</script>

<template>
  <div ref="map" class="absolute left-0 top-0 h-full w-full bg-transparent" />
</template>

What did you expect to happen?
no error

What actually happened?
'map' is defined as ref, but never used.eslintvue/no-unused-refs

Repository to reproduce this issue

wukong-gamemap

@fxzer fxzer changed the title useTemplateRef eslintvue/no-unused-refs error useTemplateRef 'xxx' is defined as ref, but never used.eslintvue/no-unused-refs Sep 16, 2024
@FloEdelmann
Copy link
Member

Duplicate of #2547. This is already fixed but not yet released.

@FloEdelmann FloEdelmann closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants