NiklasPor / prettier-plugin-organize-attributes

Organize your HTML attributes automatically with Prettier 🧼
MIT License
197 stars 12 forks source link

Add option to group when attribute no has value #8

Open feiner11 opened 2 years ago

feiner11 commented 2 years ago

Would it be possible to add an option to group attributes when they don't have a value? This would be useful for Angular.

Example: <app-selector> class="some-class" id="anId" formControlName="someControl" appDisableControl required [(ngModel)]="someModel" </app-selector>

Would be very helpful to choose where appDisableControl and required were placed in the list.

Thanks

NiklasPor commented 2 years ago

Interesting requirement, I could add an additional matcher for that, but seems very specific to me 👀 Also, the matching is currently only happening via keys and not via values, but it would be possible to implement.

feiner11 commented 2 years ago

It is definitely specific but it would be very useful for Angular since it is very common with directives.

mminor-dev commented 1 year ago

Looking for exactly this functionality. Also Angular context, but could see it being nice for common attributes that don't necessarily have values i.e. <input required>

publicJorn commented 1 year ago

Nice feature request, I don't think it's specific to Angular either. Check boolean attributes on MDN.