npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-better-tailwindcss

v4.2.0

Published

auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.

Readme

ESLint/Oxlint plugin with formatting and linting rules to help you write cleaner, more maintainable Tailwind CSS.

The formatting rules focus on improving readability by automatically breaking up long Tailwind class strings into multiple lines and sorting/grouping them in a logical order. The linting rules enforce best practices and catch potential issues, ensuring that you're writing valid Tailwind CSS.

This plugin supports a wide range of projects, including React, Solid.js, Qwik, Svelte, Vue, Astro, Angular, HTML or plain JavaScript or TypeScript.

Buy me a coffee | GitHub Sponsors

Help support this project.
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-better-tailwindcss

Quick start

Depending on the flavor you are using, you need to install and configure the corresponding parser:

Rules

The rules are categorized into two types: stylistic and correctness.

Configs

The plugin offers three recommended configurations to help you get started quickly:

  • stylistic: Enforces stylistic rules for tailwind classes.
  • correctness: Enforces correctness rules for tailwind classes.
  • recommended: Enforces both stylistic and correctness rules.

By default:

  • stylistic rules are reported as warnings
  • correctness rules are reported as errors

You can change the severity by adding a suffix to the config name:

  • Use -error to report all rules as errors
  • Use -warn to report all rules as warnings

For example, recommended-warn will report every rule as a warning and stylistic-error will report the formatting rules as errors.

If you still use the old .eslintrc configuration format, you can prefix the config names with legacy-.

For example, legacy-recommended or legacy-correctness-warn.

The table below lists all available rules, the Tailwind CSS versions they support, and whether they are enabled by default in each recommended configuration:

Stylistic rules

| Name | Description | tw3 | tw4 | recommended | autofix | | :--- | :--- | :---: | :---: | :---: | :---: | | enforce-consistent-line-wrapping | Enforce consistent line wrapping for tailwind classes. | ✔ | ✔ | ✔ | ✔ | | enforce-consistent-class-order | Enforce a consistent order for tailwind classes. | ✔ | ✔ | ✔ | ✔ | | enforce-consistent-variable-syntax | Enforce consistent variable syntax. | ✔ | ✔ | | ✔ | | enforce-consistent-important-position | Enforce consistent position of the important modifier. | ✔ | ✔ | | ✔ | | enforce-shorthand-classes | Enforce shorthand class names. | ✔ | ✔ | | ✔ | | enforce-canonical-classes | Enforce canonical class names. | | ✔ | ✔ | ✔ | | no-duplicate-classes | Remove duplicate classes. | ✔ | ✔ | ✔ | ✔ | | no-deprecated-classes | Remove deprecated classes. | | ✔ | ✔ | ✔ | | no-unnecessary-whitespace | Disallow unnecessary whitespace in tailwind classes. | ✔ | ✔ | ✔ | ✔ |

Correctness rules

| Name | Description | tw3 | tw4 | recommended | autofix | | :--- | :--- | :---: | :---: | :---: | :---: | | no-unknown-classes | Report classes not registered with Tailwind CSS. | ✔ | ✔ | ✔ | | | no-conflicting-classes | Report classes that produce conflicting styles. | | ✔ | ✔ | | | no-restricted-classes | Disallow restricted classes. | ✔ | ✔ | | ✔ |

Utilities

This plugin is pre-configured to lint tailwind classes for the most popular utilities:

Advanced configuration

If an utility is not supported by default, or you want to customize the configuration, you can define which callees, attributes, tags and variables should get linted.
See the Advanced configuration guide to learn how to override or extend the default settings.

Editor configuration

VSCode

Auto-fix on save

Most 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"
  }
}