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

eslint-plugin-tailwindcss

> 前端框架
Open source

ESLint plugin for Tailwind CSS usage

2.1K stars0 likes0 views
WebsiteGitHub

About

ESLint plugin for Tailwind CSS usage

# `eslint-plugin-tailwindcss` - Best practices & consistency since 2021 - [Made for Tailwind CSS v4](./CHANGELOG.md#made-for-tailwind-css-v4) - [9 rules available](#rules) and more on the way - What's new? [Changelog](./CHANGELOG.md) | [Release notes](https://github.com/francoismassart/eslint-plugin-tailwindcss/releases) | [Roadmap](./ROADMAP.md) - [Upgrade guide](./UPGRADE.md) from `v3` to `v4` ## This project needs your help

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](https://eslint.org/docs/user-guide/command-line-interface#--fix).\ Manually fixable by [editor suggestions](https://eslint.org/docs/latest/use/core-concepts#rule-suggestions). | Name                               | Description | | ⚠️ | | | | :------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | :-- | :-- | :-- | :-- | | [classnames-order](docs/rules/classnames-order.md) | Enforces a consistent order for the Tailwind CSS classnames, based on the compiler. | | ✅ | | | | [enforces-canonical-classname](docs/rules/enforces-canonical-classname.md) | Enforces the canonical spelling of a classname, as resolved by the Tailwind CSS compiler. | | ✅ | | | | [enforces-negative-arbitrary-values](docs/rules/enforces-negative-arbitrary-values.md) | Warns about `-` prefixed classnames using arbitrary values. | | ✅ | | | | [enforces-shorthand](docs/rules/enforces-shorthand.md) | Avoid using multiple Tailwind CSS classnames when not required. | | ✅ | | | | [important-modifier-suffix](docs/rules/important-modifier-suffix.md) | In v4 you should place the `!` at the very end of the class name. | | ✅ | | | | [no-arbitrary-value](docs/rules/no-arbitrary-value.md) | Forbid using arbitrary values in classnames. | | | | | | [no-contradicting-classname](docs/rules/no-contradicting-classname.md) | Avoid contradicting Tailwind CSS classnames. | ✅ | | | | | [no-custom-classname](docs/rules/no-custom-classname.md) | Detects classnames which do not belong to Tailwind CSS. | | ✅ | | | | [no-unnecessary-arbitrary-value](docs/rules/no-unnecessary-arbitrary-value.md) | 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 `({...})`: ```js 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](https://eslint.org/docs/latest/use/configure/configuration-files#configuring-shared-settings) from the official documentation. Here is a fully detailed example of shared settings: ``` … ``` The default settings are exported via the [`DEFAULT_SETTINGS`](src/utils/parse-plugin-settings.ts). ## Contributing The project is open to all developers, you can [contribute to `eslint-plugin-tailwindcss`](CONTRIBUTING.md). 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 框架