ESLint plugin to automatically break up long tailwind class strings into multiple lines based on a specified print width or class count. This improves readability and eliminates horizontal scrolling.
In addition it sorts the classes logically, removes unnecessary whitespaces and duplicate classes and groups the classes by their variants. It works in React, Solid.js, Qwik, Svelte, Vue, Angular, HTML, JavaScript and TypeScript projects.
This project is financed by the community.
If you or your company benefit from this project, please consider becoming a sponsor or making a one-time donation.
Your contribution will help me to maintain and develop the project.
Installation
npm i -D eslint-plugin-readable-tailwind
Quick start
Follow the parsers section below to learn how to configure the plugin for your specific requirements.
Configure the plugin to be able to read your tailwind configuration via settings or for each rule separately.
// eslint.config.js
{
//...
"settings": {
"readable-tailwind": {
// tailwindcss 4: the path to the entry file of the css based tailwind config (eg: `src/global.css`)
"entryPoint": "src/global.css",
// tailwindcss 3: the path to the tailwind config file (eg: `tailwind.config.js`)
"tailwindConfig": "tailwind.config.js"
}
}
}
In case an utility is not supported or you have built your own, you can change which literals will get linted for each rule.
Read the API documentation to learn how to override or extend the default config.
Editor configuration
VSCode
Auto-fix on save
All rules are intended to automatically fix the tailwind classes. If you have installed the VSCode ESLint plugin, you can configure it to automatically fix the classes on save by adding the following options to your .vscode/settings.json:
{
// enable ESLint to fix tailwind classes on save
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
The npm package eslint-plugin-readable-tailwind receives a total of 9,592 weekly downloads. As such, eslint-plugin-readable-tailwind popularity was classified as popular.
We found that eslint-plugin-readable-tailwind 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.
Package last updated on 15 Apr 2025
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.
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.