-
-
Notifications
You must be signed in to change notification settings - Fork 681
Rule proposal: vue/reserved-property-names
#144
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
@chrisvfritz i think we should update/add more reserved names, current list is defined here: |
I think it shouldn't warn on |
I know that list is not enough, we should just fill it in with all reserved names, instead of adding new rule.
In data properties witch starts with |
Adding every name may be too much |
@mysticatea @michalsnik should we extend |
An issue with lists is we can't predict what might be used by Vue in the future. Using a |
Thank you for the suggestion. @chrisvfritz The If Vue.js reserves the properties that start with I found it in the description of
@posva I think the rule should warn data properties which start with |
@mysticatea No, I haven't added it to the API reference, but may well do in the future. We just need to finalize what our official suggestion is. I'm leaning towards:
Perhaps the blacklist is sufficient for |
@chrisvfritz i can agree with Never to use I see this rule as:
|
I think we should stay with the current rule and add only an extra check for properties that starts with |
@michalsnik I think we can hold off on this for now, especially since Vue now warns about the use of reserved properties. Later, once this and the style guide are officially stable, we can possibly make this a separate rule with the style guide's Priority D. |
I just created new issue with proposition strictly aligned with the style guide: #246 I think that having one unified way of marking properties/methods as private using universal prefix |
Please describe what the rule should do:
This rule warns about using potentially reserved property names for props, data, computed properties, and methods. There's an ongoing discussion here, but tentatively, we're thinking of warning for any names that match the regex:
/^(\$[^_]|_)/
.We've yet to reach consensus on the exact strategy, but we'd also like to suggest a different naming strategy for private property names used in mixins/plugins. One idea is the
$_
prefix, with a suggested namespace like$_pluginOrMixinName_propertyName
to avoid conflicts with other mixins/plugins.What category of rule is this?
[ ] Enforces code style
[x] Warns about a potential error
[x] Suggests an alternate way of doing something
[ ] Other (please specify:)
Provide code examples that this rule will warn about:
A few examples to match:
A few examples NOT to match:
The text was updated successfully, but these errors were encountered: