Skip to content
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

Enforce order of attributes #724

Closed
michaeljota opened this issue Nov 13, 2018 · 0 comments
Closed

Enforce order of attributes #724

michaeljota opened this issue Nov 13, 2018 · 0 comments

Comments

@michaeljota
Copy link

From eslint-plugin-vue~attributes-order

I think it would be nice to have something like this in Angular as well. However, I would suggest to follow first some HTML style guides as:

Attribute order

HTML attributes should come in this particular order for easier reading of code.

  • class
  • id, name
  • data-*
  • src, for, type, href, value
  • title, alt
  • role, aria-*

Classes make for great reusable components, so they come first. Ids are more specific and should be used sparingly (e.g., for in-page bookmarks), so they come second.

After that I would place Angular attributes, maybe something like this order

  • Input Binding
  • Event Binding
  • Banana Box Binding
  • Template Binding
  • Template Reference

However, in Vue this is configurable, so this maybe configurable as well here.

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

No branches or pull requests

2 participants