Describe the bug#
Rules that are using ASTUtils.getFunctionAncestor utility are not catching errors in .vue files, because in typical Vue file there will be no ancestor node of these types
<template>
...
</template>
<script setup>
import { useQuery } from '@tanstack/vue-query'
const param = ref('init')
const {data} = useQuery({
queryKey: [],
// ^ should error
queryFn: () => fetch(param.value)
})
</script>
Your minimal, reproducible example#
Steps to reproduce#
From eslint rules perspective, vue files are only bodies of <script> blocks, so this is what actually got linted:
https://astexplorer.net/#/gist/91045e1d61e58247f12cdde6f344a9a7/ab878660138f9633d607b0ee0298f8848dc395d4
Expected behavior#
Should error:
The following dependencies are missing in your queryKey: param.value
eslint[@tanstack/query/exhaustive-deps]
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
Tanstack Query adapter#
vue-query
TanStack Query version#
5.91.3
TypeScript version#
No response
Additional context#
No response
📝 CodeRabbit Plan Mode#
Generate an implementation plan and agent prompts for this issue.
Examples
🔗 Related PRs#
TanStack/query#9687 - fix(eslint-plugin): exhaustive-deps with variables and type assertions (#9643) [merged] TanStack/query#9759 - fix(eslint-plugin): avoid imports from typescript [merged] TanStack/query#9813 - docs(solid-query): fix incorrect Vue.js code example in Suspense guide [merged] TanStack/query#9828 - fix(eslint-plugin): validate hook import [closed]
👤 Suggested Assignees#
🧪 Issue enrichment is currently in early access.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml: