Registry /
devops / prettier-plugin-organize-attributes
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
plugin (automatically loaded)
✓ // add to .prettierrc: { "plugins": ["prettier-plugin-organize-attributes"] }
✗ // using require() or import in code - not needed, configured via Prettier config
Plugin is loaded by Prettier via configuration, not directly imported in source code.
attributeGroups (config option)
✓ // .prettierrc
{ "attributeGroups": ["^class$", "$DEFAULT"] }
✗ // omitting "plugins" key - required since Prettier 3
The option is a string array of regex patterns and special placeholders like $DEFAULT.
attributeSort (config option)
✓ // .prettierrc
{ "attributeSort": "ASC" }
✗ // using "asc" or true - must be "ASC" or "DESC" string
Case-insensitive? Actually must be uppercase; default is no sort (preserve order).
Shows installation, configuration with custom groups and sorting, and a run example.
// Install
npm install --save-dev prettier prettier-plugin-organize-attributes
// .prettierrc
{
"plugins": ["prettier-plugin-organize-attributes"],
"attributeGroups": ["^class$", "^id$", "$DEFAULT"],
"attributeSort": "ASC"
}
// Input: index.html
<div id="myid" class="myclass" src="img.jpg"></div>
// Run: npx prettier --write index.html
// Output:
// <div class="myclass" id="myid" src="img.jpg"></div>
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-organize-attributes'
Plugin not installed or not in node_modules.
fixRun npm install --save-dev prettier-plugin-organize-attributes.
Error: [prettier-plugin-organize-attributes] No matching preset/group for attribute 'xyz'
Attribute does not match any group and $DEFAULT is not present.
fixAdd '$DEFAULT' to attributeGroups array in config, or add a specific group covering that attribute.
prettier --write fails silently with no changes even though plugin is in config
File extension not associated with 'html' parser; plugin only runs on HTML-like files.
fixAdd overrides in Prettier config: { "overrides": [{ "files": "*.template", "options": { "parser": "html" } }] } Audit
Dependencies
prettierrequiredpeer dependency: plugin requires Prettier ^3.0.0