-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Warn when a data property name starts with $ or _ #7070
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
Just in case, there's more information at https://vuejs.org/v2/api/#data, and it's both, for As stated at #5879 (comment), we're open on PRs for warnings. Here's a similar commit that implemented warning for conflicting methods that started with Related: #6312 |
@posva is the new title correct? Do you only want to warn for computed properties? I would have thought the warning would be for data + computed + methods. Or just for data. Happy to help with this but just need to be sure what needs doing :) |
On second thought, I'm not sure we should introduce this warning as it would show warnings for many plugins dev/users as they purposely use the @chrisvfritz already proposed to add the warning functionality under another config flag to not flood existing plugins using Maybe we could go the other way around, adding an error for conflicting data properties and proxying them as well |
I think main issue from the example above is that when a data property begins with $ or _ the warning says that the data property is not defined, which could be confusing. How about if a data property begins with $ or _ then a console warning is shown which is along the lines of what the docs say:
|
@rpemberton That's perfectly fine as we're not breaking anything, feel free to do the PR and thank you 🙂 |
@posva |
I've been reading this issue in order to understand what I could do to help and if there was nobody working on it already but seems that it is invalided by now and feature can not be implemented without breaking other things, right? Can you guys update this issue and remove the contribution tag? |
let's close this for the moment, thanks for the reminder 🙂 |
Version
2.5.3
Reproduction link
http://jsfiddle.net/p48cLbe3/3/
Steps to reproduce
What is expected?
Property name starts with $ or _ identifier should all valid or invalid whether defined in data/computed/methods option, i think these options's behaviors should be consistent
What is actually happening?
It's valid to define $xxx property in computed/methods option, but fall to define $xxx in data option
The text was updated successfully, but these errors were encountered: