Installations
npm install eslint-plugin-tailwindcss-jsx
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
16.18.0
NPM Version
8.3.1
Score
63.7
Supply Chain
94.3
Quality
70.2
Maintenance
100
Vulnerability
96.4
License
Releases
Unable to fetch releases
Love this project? Help keep it running — sponsor us today! 🚀
Download Statistics
Total Downloads
304
Last Day
1
Last Week
1
Last Month
12
Last Year
67
Bundle Size
1.42 kB
Minified
790.00 B
Minified + Gzipped
Package Meta Information
Latest Version
0.0.1
Package Id
eslint-plugin-tailwindcss-jsx@0.0.1
Unpacked Size
63.12 kB
Size
14.94 kB
File Count
38
NPM Version
8.3.1
Node Version
16.18.0
Published on
Feb 15, 2023
Total Downloads
Cumulative downloads
Total Downloads
304
Last Day
0%
1
Compared to previous day
Last Week
-50%
1
Compared to previous week
Last Month
500%
12
Compared to previous month
Last Year
-62.8%
67
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads

An ESLint plugin for Tailwind CSS v3.0+ that enforces best practices and consistency with focus on ReactJS (.jsx
& .tsx
).
📩 Installation
To get started, just install eslint-plugin-tailwindcss-jsx
as a dev-dependency:
1npm install -D eslint eslint-plugin-tailwindcss-jsx
It is also possible to install ESLint globally rather than locally (using npm install -g eslint
). However, this is not recommended, and any plugins or shareable configs that you use must be installed locally in either case.
⚙️ Configuration
.eslintrc.[js/json]
Use our preset to get reasonable defaults:
1// .. 2 "extends": [ 3 "eslint:recommended", 4 "plugin:tailwindcss-jsx/recommended" 5 ] 6// ..
You should also specify settings that will be shared across all the plugin rules. (More about eslint shared settings)
1{ 2 "settings": { 3 "tailwindConfigPath": "tailwind.config.js", // Relative path to the TailwindCSS config file from the root directory 4 "attributesRegex": /\b(class|className)\b/g.source, // Regex to match Attribute Nodes that contain TailwindCSS class names 5 "calleesRegex": /\b(clsx|cls|classnames)\b/g.source, // Regex to match Call Expression Nodes that contain TailwindCSS class names 6 "tagsRegex": /\b(tss)\b/g.source, // Regex to match Tag Expression Nodes that contain TailwindCSS class names 7 } 8}
If you do not use a preset you will need to specify individual rules and add extra configuration.
Add tailwindcss-jsx
to the plugins section:
1// .. 2 "plugins": [ 3 "tailwindcss-jsx", 4 ] 5// ..
Enable JSX support
1// .. 2"parserOptions": { 3 "ecmaFeatures": { 4 "jsx": true 5 } 6} 7// ..
Enable the rules that you would like to use:
1// .. 2 "plugins": [ 3 "tailwindcss-jsx/sort-classes": "error", 4 ] 5// ..
Sharable configs
Recommended
This plugin exports a recommended
configuration that enforces TailwindCSS best practices. To enable this configuration use the extends
property in your .eslintrc
config file:
1// .. 2"extends": ["eslint:recommended", "plugin:tailwindcss-jsx/recommended"] 3// ..
See eslint
documentation for more information about extending configuration files.
Note: These configurations will enable JSX in parser options.
eslint.config.js
coming soon
📜 List of supported rules
- ☑️ Set in the
recommended
configuration - 🔧 Automatically fixable by the
--fix
CLI option
Name | Description | ☑️ | 🔧 |
---|---|---|---|
sort-classes | Enforces consistent order of TailwindCSS class names based on the officially recommended class name order. | ☑️ | 🔧 |
extract-classes | Enforces the extraction of TailwindCSS class names if an identifier like extract-[Container] is present. | 🔧 |
🆔 License
eslint-plugin-tailwindcss-jsx
is licensed under the MIT License.
🙏 Contribution
📒 Resources
- ESLint Custom Rules Docs
- Custom ESLint Rule with Typescript Blog
- How to write custom ESLint RuleBlog
- AST Explorer
🔴 Debug via Jest Test
- Start
Javascript Debug
Terminal - Set
🔴 Debug
Point - Run test via
pnpm run test --watch
, for example:1pnpm run test -- extract-tailwind --watch
🌟 Credits
prettier-plugin-tailwindcss
- Inspiration in terms of official sorting- eslint-plugin-react - Inspiration in terms of documentation
eslint-plugin-tailwindcss
- Inspiration in terms of integration tests

No vulnerabilities found.

No security vulnerabilities found.
Other packages similar to eslint-plugin-tailwindcss-jsx
eslint-plugin-readable-tailwind
auto-wraps tailwind classes after a certain print width or class count into multiple lines to improve readability.
@anolilab/eslint-config
ESLint shareable config for the Anolilab JavaScript style guide.
@remidy/eslint-plugin
ESLint rules to enforce consistent code.