Skip to content

v-bind attribute should be sorted by its real name #410

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

Closed
ydfzgyj opened this issue Feb 26, 2018 · 4 comments · Fixed by #421
Closed

v-bind attribute should be sorted by its real name #410

ydfzgyj opened this issue Feb 26, 2018 · 4 comments · Fixed by #421
Assignees
Milestone

Comments

@ydfzgyj
Copy link
Contributor

ydfzgyj commented Feb 26, 2018

In new rule vue/attributes-order, v-bind has an order as same as v-model, but I think it should not be regarded as a single group. For example v-bind:is should be placed at first but not together with other attributes.

@ydfzgyj
Copy link
Contributor Author

ydfzgyj commented Mar 6, 2018

Does anybody comment on it?

@michalsnik
Copy link
Member

I commented in PR, I think we can separate those groups and have BINDINGS and TWO_WAY_BINDINGS (although there is only v-model in this case). What do you think @chrisvfritz ?

@chrisvfritz
Copy link
Contributor

I actually don't think we need a BINDINGS group. The style guide makes no distinction between bound and unbound attributes. In fact, it would seem a little strange to me to group all bound attributes together. For example, class and style can both have bound and unbound versions on the same element, such as:

<div
  :class="..."
  class="..."
  :style="..."
  style="..."
/>

Also, when changing an attribute between bound and unbound, forcing the attribute to then move would not only slow down development, but also make the diff less readable during code reviews.

As an aside though, in the special cases of v-on="objectOfListeners and v-bind="objectOfAttributes", I think those should probably appear at the beginning of the style guide's Other Attributes and Events sections, respectively.

Does that make sense?

@michalsnik
Copy link
Member

It makes perfect sense indeed @chrisvfritz. I didn't thought about class/style case, and it's soo common.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants