Gathering detailed insights and metrics for @kikiutils/eslint-plugin-tailwindcss
Gathering detailed insights and metrics for @kikiutils/eslint-plugin-tailwindcss
Gathering detailed insights and metrics for @kikiutils/eslint-plugin-tailwindcss
Gathering detailed insights and metrics for @kikiutils/eslint-plugin-tailwindcss
ESLint plugin for Tailwind CSS usage
npm install @kikiutils/eslint-plugin-tailwindcss
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (99.58%)
CSS (0.36%)
Vue (0.06%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
400 Commits
2 Branches
1 Contributors
Updated on Mar 10, 2025
Latest Version
3.19.0
Package Id
@kikiutils/eslint-plugin-tailwindcss@3.19.0
Unpacked Size
216.80 kB
Size
40.69 kB
File Count
32
NPM Version
11.2.0
Node Version
22.14.0
Published on
Mar 10, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Rules enforcing best practices and consistency using Tailwind CSS.
While you can use the official plugin prettier-plugin-tailwindcss
for ordering your classnames...
eslint-plugin-tailwindcss
offers more than 5 other rules, that you can benefit from on top of prettier-plugin-tailwindcss
. Sounds good ? Keep reading 👇
Learn more about each supported rules by reading their documentation:
classnames-order
: order classnames for consistency and it makes merge conflict a bit easier to resolveenforces-negative-arbitrary-values
: make sure to use negative arbitrary values classname without the negative classname e.g. -top-[5px]
should become top-[-5px]
enforces-shorthand
: merge multiple classnames into shorthand if possible e.g. mx-5 my-5
should become m-5
migration-from-tailwind-2
for easy upgrade from Tailwind CSS v2
to v3
.
Warning: at the moment you should temporary turn off the no-custom-classname
rule if you want to see the warning from migration-from-tailwind-2
no-arbitrary-value
: forbid using arbitrary values in classnames (turned off by default)no-custom-classname
: only allow classnames from Tailwind CSS and the values from the whitelist
optionno-contradicting-classname
: e.g. avoid p-2 p-3
, different Tailwind CSS classnames (pt-2
& pt-3
) but targeting the same property several times for the same variant.no-unnecessary-arbitrary-value
: e.g. replacing m-[1.25rem]
by its configuration based classname m-5
Using ESLint extension for Visual Studio Code, you will get these messages
You can can the same information on your favorite command line software as well.
eslint-plugin-tailwindcss
🥰 How you can support us? | 💪 They did it! |
---|---|
Premium Sponsors Support us by becoming a sponsor. Become a recurring sponsor | ![]() |
Current Sponsors Any amount is appreciated. | |
Past sponsors Even if this is just a one-time thing. Become a backer | |
Contributors This project can evolve thanks to all the people who contribute. You are welcome to contribute to this project by reporting issues, feature requests or even opening Pull Requests. | |
Supporters Talk about the plugin on your social networks | Share the word on Bluesky or Reach my profile |
enforces-shorthand
rule now support place-content-*
/place-items-*
/place-self-*
enforces-shorthand
does not work for h-
& w-
when prefixed (by Kamahl19 🙏)no-arbitrary-value
rule is too broadtag.div
and tag(Component)
(by nihalgonsalves 🙏)no-unnecessary-arbitrary-value
🎉shadow-md
+ shadow-[#color]
can be used together 🤝tabular-nums
and slashed-zero
can be used together 🤝size-*
based size
, spacing
, width
and height
🤓size-screen
😅enforces-shorthand
(by kachkaev 🙏)3.3.2
![]() | ESLint plugin Tailwind CSS youtube.com/@eslint-plugin-tailwindcss |
---|
eslint
and eslint-plugin-tailwindcss
You'll first need to install ESLint:
$ npm i -D eslint eslint-plugin-tailwindcss
.eslintrc
Use .eslintrc.* file to configure rules in ESLint < v9. See also: https://eslint.org/docs/latest/use/configure/.
1module.exports = { 2 root: true, 3 extends: ["plugin:tailwindcss/recommended"], 4};
If you would like to know about configuration, Learn more in ESLint docs
eslint.config.js
Use eslint.config.js
file to configure rules. This is the default in ESLint v9, but can be used starting from ESLint v8.57.0. See also: https://eslint.org/docs/latest/use/configure/configuration-files-new.
1import tailwind from "eslint-plugin-tailwindcss"; 2 3export default [...tailwind.configs["flat/recommended"]];
If you would like to know about configuration, Learn more in ESLint docs
Depending on the languages you are using in your project you must tell which parser will analyze your source files.
Our recommendations:
.eslintrc
js[x]
, react
, ts[x]
:
npm i -D @typescript-eslint/parser
eslintrc
:
1overrides: [ 2 { 3 files: ['*.ts', '*.tsx', '*.js'], 4 parser: '@typescript-eslint/parser', 5 }, 6],
vue.js
:
npm i -D vue-eslint-parser
eslintrc
:
1overrides: [ 2 { 3 files: ['*.vue'], 4 parser: 'vue-eslint-parser', 5 }, 6],
HTML
and similar:
npm i -D @angular-eslint/template-parser
eslintrc
:
1overrides: [ 2 { 3 files: ['*.html', '*.blade.php'], 4 parser: '@angular-eslint/template-parser', 5 }, 6],
We removed the default parsers which were added to
v3.8.2
because it created negative impact on dependencies resolution, bundle size increase and possible conflicts with existing configurations.
eslint.config.js
For js[x]
, ts[x]
:
Install the parser: npm i -D @eslint/js typescript-eslint
Assign it to your files in eslint.config.js
:
1import js from "@eslint/js"; 2import ts from "typescript-eslint"; 3import tailwind from "eslint-plugin-tailwindcss"; 4 5export default [ 6 // add eslint built-in 7 js.configs.recommended, 8 // add `typescript-eslint` flat config simply 9 // if you would like use more another configuration, 10 // see the section: https://typescript-eslint.io/getting-started#details 11 ...ts.configs.recommended, 12 ...tailwind.configs["flat/recommended"], 13];
For vue.js
:
Install the parser: npm i -D eslint-plugin-vue
Assign it to your files in eslint.config.js
:
1import vue from "eslint-plugin-vue"; 2import tailwind from "eslint-plugin-tailwindcss"; 3 4export default [ 5 // add `eslint-plugin-vue` flat config simply 6 // if you would like use more another configuration, 7 // see the section: https://eslint.vuejs.org/user-guide/#bundle-configurations-eslint-config-js 8 ...vue.configs["flat/recommended"], 9 ...tailwind.configs["flat/recommended"], 10];
In your package.json
add one or more script(s) to run eslint targeting your source files:
1"scripts": { 2 "lint": "eslint ./src", 3 "lint:debug": "eslint ./src --debug", 4 "lint:fix": "eslint ./src --fix" 5},
npm run lint
can do the job on demand but you can also get live feedback using VS Code ESLint extension, just make sure you restart VS Code as it can be required for the plugin to work as expected.
The rules accept settings meant to fit your own choices, make sure to read the documentation of each rule.
Most rules share the same settings, instead of duplicating the options all over the place...
You should define the shared settings that will be shared across all the plugin rules.
All these settings already have nice default values that are explained in the documentation.
.eslintrc
FYI, here are the default
values:
1{ 2 settings: { 3 tailwindcss: { 4 // These are the default values but feel free to customize 5 callees: ["classnames", "clsx", "ctl"], 6 config: "tailwind.config.js", // returned from `loadConfig()` utility if not provided 7 cssFiles: [ 8 "**/*.css", 9 "!**/node_modules", 10 "!**/.*", 11 "!**/dist", 12 "!**/build", 13 ], 14 cssFilesRefreshRate: 5_000, 15 removeDuplicates: true, 16 skipClassAttribute: false, 17 whitelist: [], 18 tags: [], // can be set to e.g. ['tw'] for use in tw`bg-blue` 19 classRegex: "^class(Name)?$", // can be modified to support custom attributes. E.g. "^tw$" for `twin.macro` 20 }, 21 }, 22}
eslint.config.js
1import tailwind from "eslint-plugin-tailwindcss"; 2 3export default [ 4 ...tailwind.configs["flat/recommended"], 5 { 6 settings: { 7 tailwindcss: { 8 // These are the default values but feel free to customize 9 callees: ["classnames", "clsx", "ctl"], 10 config: "tailwind.config.js", // returned from `loadConfig()` utility if not provided 11 cssFiles: [ 12 "**/*.css", 13 "!**/node_modules", 14 "!**/.*", 15 "!**/dist", 16 "!**/build", 17 ], 18 cssFilesRefreshRate: 5_000, 19 removeDuplicates: true, 20 skipClassAttribute: false, 21 whitelist: [], 22 tags: [], // can be set to e.g. ['tw'] for use in tw`bg-blue` 23 classRegex: "^class(Name)?$", // can be modified to support custom attributes. E.g. "^tw$" for `twin.macro` 24 }, 25 }, 26 }, 27];
The plugin will look for each setting in this order and stops searching as soon as it finds the settings:
validate-modifiers
: I don't know if possible, but I'd like to make sure all the modifiers prefixes of a classname are valid e.g. yolo:bg-red
should throw an error...
no-redundant-variant
: e.g. avoid mx-5 sm:mx-5
, no need to redefine mx
in sm:
variant as it uses the same value (5
)
only-valid-arbitrary-values
:
top-[42]
, only 0
value can be unitless.text-[rgba(10%,20%,30,50%)]
, can't mix %
and 0-255
.No vulnerabilities found.
No security vulnerabilities found.