You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What did you expect to happen?
No errors, only root-level variables should be considered, the nested variables are ignored by Vue when assigning template refs (in onMounted I get null). I had noticed this when trying to implement fix option for this rule. I wanted to create an issue to properly discuss whether this is an expected behavior.
What actually happened?
15:31 error Replace 'ref' with 'useTemplateRef' vue/prefer-use-template-ref
18:28 error Replace 'ref' with 'useTemplateRef' vue/prefer-use-template-ref
Repository to reproduce this issue
The text was updated successfully, but these errors were encountered:
Thomasan1999
changed the title
prefer-use-template-ref: should check only root-level variablesprefer-use-template-ref: should check only root-level variables
Nov 14, 2024
Yes,refs inside functions should definitely be ignored. I think we should only consider refs defined in the root scope of <script setup> or the setup() function.
Checklist
Tell us about your environment
Please show your full configuration:
What did you do?
What did you expect to happen?
No errors, only root-level variables should be considered, the nested variables are ignored by Vue when assigning template refs (in
onMounted
I getnull
). I had noticed this when trying to implement fix option for this rule. I wanted to create an issue to properly discuss whether this is an expected behavior.What actually happened?
Repository to reproduce this issue
The text was updated successfully, but these errors were encountered: