Sorting
Oxfmt includes sorting features for imports, Tailwind classes, and package.json.
Sort imports
WARNING
For progress, see tracking issue.
Based on eslint-plugin-perfectionist/sort-imports.
Disabled by default.
Example configuration
Sort imports by distance (furthest to closest):
json
{
"experimentalSortImports": {
"groups": [
["side-effect"],
["builtin"],
["external", "external-type"],
["internal", "internal-type"],
["parent", "parent-type"],
["sibling", "sibling-type"],
["index", "index-type"]
]
}
}Tailwind CSS class sorting
Sorts Tailwind utility classes.
Based on prettier-plugin-tailwindcss.
Disabled by default.
Example configuration
json
{
"experimentalTailwindcss": {
"stylesheet": "./path/to/stylesheet.css",
"attributes": ["class", "className"],
"functions": ["clsx", "cn"],
"preserveWhitespace": true
}
}Regex patterns for attributes are not supported.
Sort package.json fields
Sorts keys in package.json using an opinionated order.
See field ordering for details.
Enabled by default.
Example configuration
To disable:
json
{
"experimentalSortPackageJson": false
}To sort scripts alphabetically:
json
{
"experimentalSortPackageJson": {
"sortScripts": true
}
}