eslint-plugin-tailwindcss

ESLint rules that keep Tailwind CSS classnames consistent, valid, and free of contradictions.

Tool
npm
v4.4.0
2,072 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
71 /100 Good
Development Activity 48
Maintenance 80
Community 56
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
86 /100 Excellent
Architecture 85
Code Quality 88
Innovation 80
Learning Curve 90

eslint-plugin-tailwindcss is a set of ESLint rules purpose-built for projects using Tailwind CSS v4. Rather than leaving classname hygiene to code review, it plugs directly into the ESLint flat config pipeline and calls the real Tailwind CSS compiler (via a synchronous worker built on synckit) to check whether classnames are valid, canonical, contradictory, or could be written more concisely.

The plugin ships nine rules covering classname ordering, canonical spelling, shorthand enforcement, arbitrary-value usage, and contradiction detection, with several auto-fixable via --fix. Because it parses classnames out of JSX/TSX attributes, template literals, and utility functions like clsx, cva, and tw, it works across React, Vue, Svelte, and Angular templates rather than being tied to one framework.

What You Get

  • Nine rules covering classname ordering, canonical spelling, shorthand enforcement, negative-value formatting, and contradiction detection
  • Auto-fix support (--fix) for the rules that can be mechanically corrected, plus editor-suggestion fixes for the rest
  • A recommended flat-config preset that enables sensible defaults out of the box
  • Real Tailwind CSS v4 compiler integration via a synchronous worker, so validity checks reflect the actual resolved theme rather than a hardcoded utility list
  • Configurable attribute and function scanning (class, className, clsx, cva, tw, twMerge, and more) so classnames are found wherever they’re written, not just in a class attribute
  • Framework-agnostic parsing across React/JSX, Vue, Svelte, and Angular templates

Common Use Cases

  • Enforcing a consistent, deterministic classname order across a team so diffs stay clean and reviewable
  • Catching contradicting utility classes (e.g. flex and hidden fighting for the same property) before they ship
  • Flagging custom, non-Tailwind classnames that snuck into a className prop by mistake
  • Running as a CI/pre-merge check so Tailwind class hygiene doesn’t rely on manual review
  • Simplifying verbose multi-class combinations into Tailwind’s built-in shorthand utilities automatically

Under The Hood

Architecture

The plugin is organized as a standard ESLint flat-config plugin object (src/index.ts) that registers nine independent rule modules under src/rules/, each exporting a rule name and an ESLint rule object built on @typescript-eslint/utils. Classname extraction is centralized in src/utils/parser/ (classname, groups, node, and visitor modules) so every rule shares the same logic for locating classnames inside JSX attributes, template literals, and utility-function calls rather than re-implementing extraction per rule. The most consequential architectural choice is src/utils/tailwindcss-api/index.ts, which offloads calls into the real Tailwind CSS v4 compiler to a worker thread via synckit’s createSyncFn, exposing it to ESLint’s synchronous rule API through a small in-memory cache (theme, sorted classnames, validity, class properties) with size- and age-based eviction — this is what lets rules make compiler-accurate decisions without ESLint having to go async.

Tech Stack

Written in TypeScript and built with unbuild, targeting Node 20.19+ and ESLint 9/10 via @typescript-eslint/utils’s flat-config types. It depends on postcss and postcss-nested for CSS parsing, tailwind-api-utils and a bundled worker script for talking to the real Tailwind compiler, and synckit to bridge that async compiler API into ESLint’s synchronous rule execution model. Framework-specific parsing is handled through peer parsers pulled in as dev/test dependencies only when needed (vue-eslint-parser, svelte-eslint-parser, @angular-eslint/template-parser).

Code Quality

Test coverage is extensive and co-located: nearly every rule and utility file under src/ has a matching .spec.ts file, and several performance-sensitive utilities (enforces-shorthand, get-theme-key-prefixes-from-classname) also have .bench.ts benchmark files, run via Vitest. CI (.github/workflows) runs pnpm run lint and pnpm run test on every push. The project dogfoods eslint-plugin-eslint-plugin and eslint-plugin-unicorn on its own source, and rules are fully typed against ESLint’s flat-config Rule types rather than using loosely-typed rule objects.

API Design The public surface is intentionally small: install the plugin, spread the recommended config, and set one required setting (cssConfigPath) pointing at the project’s Tailwind CSS file. A typed PluginSettings export gives editors autocomplete and validation on the settings object via JSDoc @type annotations, and sensible defaults exist for every other setting (which attributes/functions to scan, cache size/age) so most projects only ever touch the one mandatory field.

Used by 11 apps in this directory

TypeScript
100%
Other

Activepieces

AI Assistants · Automation · Mcp

25,408

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
64
Dependency
Built with
TypeScript 100%
Updated 1 weeks ago
Rust
58%
Other

Cap

Team Chat · Video Conferencing

24,546

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust 58%
TypeScript 34%
Updated 1 weeks ago
TypeScript
64%
MIT

Ghost

Blogging · CMS

55,701

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
64
Dependency
Built with
TypeScript 64%
JavaScript 33%
Updated 1 weeks ago
TypeScript
71%
Other

highlight.io

Analytics · Developer Tools · Monitoring

9,386

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
74
Repo Health
78
Technical
65
Dependency
Built with
TypeScript 71%
Go 16%
Updated 3 weeks ago
TypeScript
96%
Other

Langfuse

AI Development · Monitoring

37,118

Open source AI engineering platform for LLM observability, prompt management, evaluation, and debugging — self-host in minutes or use Langfuse Cloud.

View details
92
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
51%
Other

Magic

AI Agents · Automation · Low Code Platforms

5,077

Magic is an enterprise-grade open-source AI agent platform combining a generalist AI agent, workflow engine, IM, and collaborative office system for running an AI-powered digital workforce.

View details
74
Repo Health
79
Technical
65
Dependency
Built with
TypeScript 51%
PHP 24%
Python 11%
Updated 3 weeks ago
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,385

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
91
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago
TypeScript
94%
Apache 2.0

Nanobrowser

AI Assistants · Automation · Productivity

14,256

Open-source Chrome extension for AI-powered web automation — run multi-agent browser workflows locally using your own LLM API keys, free from cloud subscriptions.

View details
80
Repo Health
66
Technical
72
Dependency
Built with
TypeScript 94%
Updated 3 weeks ago
Ruby
63%
MIT

OnetimeSecret

Security

2,989

Generate self-destructing single-use links to share passwords and sensitive data without leaving traces in inboxes or chat logs.

View details
92
Repo Health
81
Technical
72
Dependency
Built with
Ruby 63%
TypeScript 24%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers