Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
prettier-plugin-organize-attributes
Advanced tools
Organize your HTML attributes autmatically with Prettier 🧼
npm i prettier prettier-plugin-organize-attributes -D
$DEFAULT
.$DEFAULT
is not specified they are appended at the end.ASC
and DESC
by specifing attributeSort
.
attributeSort
is not used.The following files also work out of the box if the plugin is specified:
.html
– HTML Example.component.html
– Angular Example.vue
– Vue Example// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
}
Starting with Prettier 3 this is required ⬆️
Read below for writing custom attribute orders and configurations ⤵️
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
"attributeGroups": ["^class$", "^(id|name)$", "$DEFAULT", "^aria-"]
}
<!-- input -->
<div
aria-disabled="true"
name="myname"
id="myid"
class="myclass"
src="other"
></div>
<!-- output -->
<div
class="myclass"
name="myname"
id="myid"
src="other"
aria-disabled="true"
></div>
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
"attributeGroups": ["$DEFAULT", "^data-"],
"attributeSort": "ASC"
}
<!-- input -->
<div a="a" c="c" b="b" data-c="c" data-a="a" data-b="b"></div>
<!-- output -->
<div a="a" b="b" c="c" data-a="a" data-b="b" data-c="c"></div>
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
"attributeGroups": ["^group-a$", "^group-b$", "^group-A$", "^group-B$"],
"attributeIgnoreCase": false
}
<!-- input -->
<div group-b group-B group-A group-a></div>
<!-- output -->
<div group-a group-b group-A group-B></div>
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"]
}
<!-- input.html -->
<div id="id" other="other" class="style"></div>
<!-- output.html -->
<div class="style" id="id" other="other"></div>
// .prettierrc
{}
<!-- input.component.html -->
<div
(output)="output()"
[input]="input"
*ngIf="ngIf"
class="style"
[(ngModel)]="binding"
id="id"
other="other"
[@inputAnimation]="value"
@simpleAnimation
></div>
<!-- output.component.html -->
<div
class="style"
id="id"
*ngIf="ngIf"
@simpleAnimation
[@inputAnimation]="value"
[(ngModel)]="binding"
[input]="input"
(output)="output()"
other="other"
></div>
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
"attributeGroups": [
"$ANGULAR_OUTPUT",
"$ANGULAR_TWO_WAY_BINDING",
"$ANGULAR_INPUT",
"$ANGULAR_STRUCTURAL_DIRECTIVE"
]
}
<!-- input -->
<div
[input]="input"
(output)="output()"
*ngIf="ngIf"
other="other"
class="style"
[(ngModel)]="binding"
id="id"
></div>
<!-- output -->
<div
(output)="output()"
[(ngModel)]="binding"
[input]="input"
*ngIf="ngIf"
class="style"
id="id"
other="other"
></div>
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
}
<!-- input.vue -->
<template>
<div other="other" class="class" v-on="whatever" v-bind="bound" id="id"></div>
</template>
<!-- output.vue -->
<template>
<div class="class" id="id" v-on="whatever" v-bind="bound" other="other"></div>
</template>
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
"attributeGroups": ["$CODE_GUIDE"]
}
<!-- input -->
<div
other="other"
value="value"
type="type"
title="title"
src="src"
role="role"
name="name"
id="id"
href="href"
for="for"
data-test="test"
class="class"
aria-test="test"
alt="alt"
></div>
<!-- output -->
<div
class="class"
id="id"
name="name"
data-test="test"
src="src"
for="for"
type="type"
href="href"
value="value"
title="title"
alt="alt"
role="role"
aria-test="test"
other="other"
></div>
1.0.0
FAQs
Organize your HTML attributes autmatically with Prettier 🧼
We found that prettier-plugin-organize-attributes demonstrated a not healthy version release cadence and project activity because the last version was released 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.