-
-
Notifications
You must be signed in to change notification settings - Fork 679
Rule Proposal: no-ref-prop #1676
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
Comments
Thank you for the rule proposal! |
The documentation's Special Attributes also lists |
I also need to find out about Vue2 special attributes, so it will take some time 😅. |
We need to rename the rule because We also need to add an option to allow you to choose between Vue3 and Vue2 and switch between disallowed names. Vue2: |
great! Thanks for investigating all the reserved words for all versions!
|
Yes, that’s exactly. |
Please describe what the rule should do:
This rule should warn users that define a component prop named
ref
, as it will be unusable.What category should the rule belong to?
[ ] Enforces code style (layout)
[x] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)
Provide 2-3 code examples that this rule should warn about:
There are several ways to define props, here's the script-setup + TS way:
Additional context
You might say it should be obvious it can't be bound as the keyword
ref
inside a template is reserved for a different use, but it happened to a coworker of mine last week who lost half an hour not understanding why his component was not bound to the correct value.ref
and what it does.h()
-like API, actually he was trying to do:showModal(MyDialogComponent, /* props: */ { name: "abc", ref: 123 })
and it might not be immediately clear to you thatref
is not gonna be bound toMyDialogComponent
propref
.I haven't checked the format of the state bound to components, there might be other reserved names? Can't think of one right now.
The text was updated successfully, but these errors were encountered: