Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

eslint-plugin-tailwindcss

> 前端框架
Open source

ESLint plugin for Tailwind CSS usage

2.1K stars0 likes1 views
WebsiteGitHub

About

ESLint plugin for Tailwind CSS usage

eslint-plugin-tailwindcss

  • Best practices & consistency since 2021
  • Made for Tailwind CSS v4
  • 9 rules available and more on the way
  • What's new? Changelog | Release notes | Roadmap
  • Upgrade guide from v3 to v4

This project needs your help

</picture>

I spent countless days working on this plugin, and it is available to everyone for free.
If you benefit from my work and if you want to help me keep the project alive, consider becoming a sponsor.

Premium sponsors Current sponsors

GitHub Sponsors | thanks.dev Sponsors

Rules

Configurations enabled in.
⚠️ Configurations set to warn in.
✅ Set in the recommended configuration.
Automatically fixable by the --fix CLI option.
Manually fixable by editor suggestions.

Name Description ⚠️
classnames-order Enforces a consistent order for the Tailwind CSS classnames, based on the compiler. ✅
enforces-canonical-classname Enforces the canonical spelling of a classname, as resolved by the Tailwind CSS compiler. ✅
enforces-negative-arbitrary-values Warns about - prefixed classnames using arbitrary values. ✅
enforces-shorthand Avoid using multiple Tailwind CSS classnames when not required. ✅
important-modifier-suffix In v4 you should place the ! at the very end of the class name. ✅
no-arbitrary-value Forbid using arbitrary values in classnames.
no-contradicting-classname Avoid contradicting Tailwind CSS classnames. ✅
no-custom-classname Detects classnames which do not belong to Tailwind CSS. ✅
no-unnecessary-arbitrary-value Avoid unjustified arbitrary classnames. ✅

Getting started

1. Install the plugin

npm i -D eslint-plugin-tailwindcss

  • As it is a dev dependency, it will not affect your final bundle size
  • It can be installed with other package managers such as pnpm
  • We support ESLint v10

If you are still using Tailwind CSS v3 and/or older ESLint versions, you can use [email protected]

2. Edit your eslint.config file

Here is a very basic example:

…

cssConfigPath can be an absolute or a relative path. If you provide a relative path, the plugin will attempt to convert it into an absolute path.

Typesafe settings

The plugin also exports the type PluginSettings which you can use to benefit from autocomplete and validation directly inside your eslint.config file.

  1. You may need to add // @ts-check to force type checking
  2. Add the magic JSDoc comment /** @type {import('eslint-plugin-tailwindcss').PluginSettings} */

Here is a snippet, notice the object is surrounded by parentheses ({...}):

javascript
settings: {
  tailwindcss:
    /** @type {import('eslint-plugin-tailwindcss').PluginSettings} */
    ({
      cssConfigPath: './styles/tailwind.css',
    }),
},

3. Going further

You can also:

  • Run the linting process inside a pipeline of your hosted repository. I recommend running it on your merge/pull requests, rather than on every single (pre-)commit.
  • Auto-format on save in your favorite IDE.

Settings

Most of the rules solely use the shared settings (shared across all the plugin rules). Learn about eslint shared settings from the official documentation.

Here is a fully detailed example of shared settings:

…

The default settings are exported via the DEFAULT_SETTINGS.

Contributing

The project is open to all developers, you can contribute to eslint-plugin-tailwindcss.

However, make sure to discuss the issue or the feature you wish to implement prior to getting to work unless you feel adventurous.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScripteslint-pluginrulestailwindtailwindcss

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架