Closed
Description
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.16.0
- eslint-plugin-vue version: 9.32.0
- Vue version: 3.5.13
- Node version: 22.11.0
- Operating System: Kubuntu 22.04
Please show your full configuration:
{
// …
'vue/prefer-use-template-ref': 'error',
// …
}
What did you do?
defineComponent({
setup: () => ({}),
})
What did you expect to happen?
vue/prefer-use-template-ref
should not crash.
What actually happened?
TypeError: Cannot read properties of undefined (reading 'filter')
Occurred while linting foo.ts:220
Rule: "vue/prefer-use-template-ref"
at getScriptRefsFromSetupFunction (…/node_modules/eslint-plugin-vue/lib/rules/prefer-use-template-ref.js:33:37)
at Object.onSetupFunctionEnter (…/node_modules/eslint-plugin-vue/lib/rules/prefer-use-template-ref.js:82:33)
at callVisitor (…/node_modules/eslint-plugin-vue/lib/utils/index.js:1246:21)
at vueVisitor.Property[value.type=/^(Arrow)?FunctionExpression$/] > :function (…/node_modules/eslint-plugin-vue/lib/utils/index.js:1314:13)
at ruleErrorHandler (…/node_modules/eslint/lib/linter/linter.js:1076:28)
at …/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (…/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (…/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (…/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
Repository to reproduce this issue
https://ota-meshi.github.io/eslint-plugin-vue-demo/#eJwtyzEKhDAQRuGrhKkSMAhbBrXxGmkW/QVBJ0My2Sbk7lrsKz94jba0gwJNZcun6BJ5x3Ey1nRLYrDaFtm8FWiVYKwz82Js626I3F3kafyfNFCuFwqFRr+KUTIOZF8LvOKW66vwL1H49P4AdL8oqw==
Additional information
This was not a problem in v9.31.0, so it was probably introduced in #2608 or #2612. CC @ntnyq @Thomasan1999