Configuring oxlint with eslint-plugin-tailwindcss
This is a reference article.
Reference articles are written with the help of AI agents, after we have managed to solve a problem.
TL;DR
- Install
eslint-plugin-tailwindcss(beta for Tailwind v4, stable for v3).- Add it to
jsPluginsin.oxlintrc.json, then enable the Tailwind rules you want.- Run
npx oxlint .(ornpx oxlint --fix .for autofixable rules).
Tools like Prettier with prettier-plugin-tailwindcss handle class sorting, but they don't catch semantic issues like using arbitrary values when Tailwind equivalents exist, contradicting classes, or verbose class combinations.
oxlint can load ESLint plugins via its experimental jsPlugins field, letting you use eslint-plugin-tailwindcss without switching your entire linting setup to ESLint.
Installation
For Tailwind v4 projects, use the beta version:
For Tailwind v3 projects, use the stable version:
Configuration
Add the plugin to your .oxlintrc.json:
Recommended Rules
Rules to Avoid
Running the Linter
Run oxlint as usual:
The Tailwind v4 beta plugin outputs warnings to stderr about config resolution. Suppress them with:
Some rules support autofix:
Limitations
- The
jsPluginsfeature is marked as experimental in oxlint and is not supported in the language server - For Tailwind v4, the beta plugin shows "Cannot resolve default tailwindcss config path" warnings but still functions correctly
- Not all rules have autofix support