ESLint plugin that brings Tailwind class sorting without affecting the rest of your code formatting. Perfect companion for Biome formatter.
When migrating from Prettier to Biome for better performance, you lose Tailwind class sorting functionality. Existing solutions like eslint-plugin-prettier
with Tailwind plugin would format your entire codebase, negating Biome's performance benefits.
This plugin exclusively handles Tailwind class sorting while letting Biome handle the main formatting. It:
prettier-plugin-tailwindcss
npm install --save-dev github:rodnoycry/eslint-plugin-tailwindcss-prettier
Later after publication to NPM:
npm install --save-dev eslint-plugin-tailwindcss-prettier
{
"plugins": ["tailwindcss-prettier"],
"rules": {
"tailwindcss-prettier/order": [
"warn",
{
"attributes": ["className"],
"functions": ["clsx", "cn", "tw"]
}
]
}
}
Create .vscode/settings.json
:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
Create .vscode/extensions.json
:
{
"recommendations": [
"biomejs.biome",
"dbaeumer.vscode-eslint",
"bradlc.vscode-tailwindcss"
]
}
// Before
<div className="p-4 flex items-center">
{clsx("text-red-500 mt-2")}
</div>
// After
<div className="flex items-center p-4">
{clsx("mt-2 text-red-500")}
</div>
This solution emerged from a specific need: maintaining Tailwind class ordering while using Biome's superior formatting performance. Traditional setups using Prettier + ESLint would format the code twice, negating Biome's speed benefits. This plugin provides the best of both worlds:
MIT