
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
prettier-plugin-angular
Advanced tools
Prettier plugin for Angular HTML attribute alignment and sorting
A Prettier plugin for Angular HTML templates that formats, aligns, and sorts element attributes.
Attributes are formatted using the minimum number of lines needed:
Single line — if everything fits within printWidth:
<input type="text" [value]="v" />
Aligned — first attribute inline with the tag, rest aligned to the same column:
<p-select [options]="companiesForSelector()"
[attr.aria-invalid]="form.controls.companyId.invalid"
id="companyId"
class="w-full"
filter
showClear />
Fallback — if the tag itself is too long to inline the first attribute, each attribute on its own line indented by tabWidth:
<my-very-long-component-name
[options]="items"
(change)="onChange($event)"
class="w-full" />
Attributes are sorted by category in this order:
| Category | Examples |
|---|---|
ref | #myRef |
structural | *ngIf, *ngFor |
twoWay | [(ngModel)] |
input | [value], [disabled], [attr.aria-label] |
output | (click), (ngModelChange) |
animation | [@fadeIn] |
static | id="x", class="foo", formControlName="x" |
boolean | disabled, required, showIcon |
Elements with no real children are always output as self-closing, regardless of how they were written in the source:
<!-- Input -->
<app-my-component [value]="x" [label]="y"></app-my-component>
<!-- Output -->
<app-my-component [value]="x" [label]="y" />
This also applies to elements with only whitespace between their tags.
Elements inside @if, @for, @switch, @defer and other Angular control flow blocks are fully formatted — not emitted verbatim:
@if (form.controls.companyId.invalid && form.controls.companyId.touched) {
<small id="companyId-error" class="p-error block mt-1" role="alert">
{{ 'validation.required' | translate }}
</small>
}
npm install -D prettier-plugin-angular
In .prettierrc:
{
"plugins": ["prettier-plugin-angular"],
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular-attributes",
"angularAttributeSort": true
}
}
]
}
| Option | Type | Default | Description |
|---|---|---|---|
angularAttributeSort | boolean | true | Sort attributes by category |
angularAttributeOrder | string[] | ["ref","structural","twoWay","input","output","animation","static","boolean"] | Category order (any subset, in your preferred order) |
Input:
<p-select class="w-full" (change)="onChange($event)" [options]="items" inputId="x" #sel showIcon />
Output:
<p-select [options]="items"
(change)="onChange($event)"
inputId="x"
class="w-full"
#sel
showIcon />
FAQs
Prettier plugin for Angular HTML attribute alignment and sorting
We found that prettier-plugin-angular demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.