Open michalsnik opened 6 years ago
I would hold off on this one for a little bit, as I'd like Evan to first approve this convention when he reviews the style guide.
@chrisvfritz do we know more now?
I don't think we've had a definitive ruling yet, but I'll ping @yyx990803. 🙂
Still no word from Evan, but let's move forward on this anyway. I think no-reserved-keys
can still be useful in conjunction with this, since the $_
is only for private property names, like in plugins. There are probably two scenarios we can catch:
_
. In this case, we can warn that for private property names, the $_pluginName_propertyName
format should be used to avoid conflicts with Vue's private property names starting with _
and also conflicts with other plugins.$_
, but not following the $_pluginName_propertyName
convention. So any property names starting with $_
should match this regex: /^\$_\w+_\w+$/
. If it does not match, we can show the same warning about the format.What do you think @michalsnik?
According to the Style Guide we should warn about following keys:
_foo
$foo
and encourage to prefix private properties with
$_
(e.g.$_foo
).This rule could live alongside
no-reserved-keys
, but we might as well keep only this rule, to not duplicate warnings.