Skip to content

Latest commit

 

History

History
54 lines (33 loc) · 1.15 KB

File metadata and controls

54 lines (33 loc) · 1.15 KB

Forbid using arbitrary values in classnames

🚫 This rule is disabled in the ✅ recommended config.

This rule will shout at you if you use any arbitrary value in your classnames.

Only enable this rule if you want to stricly stick with your Tailwind  CSS config's presets.

It will not complain if you are using classnames like border-<number>.

Rule Details

Examples of incorrect code for this rule:

<div class="w-[20rem]">Custom width</div>

Examples of correct code for this rule:

<div class="w-custom-preset">Custom width</div>

with a config such as:

@import "tailwindcss";

@theme {
  --width-custom-preset: 20rem;
}

Why avoid arbitrary values?

  • 📐 Enforced design consistency
  • 🌈 Respect your Design System
  • 🧹 Cleaner, more readable markup

When to use arbitrary values?

  • 🧬 For truly unique, one-off instances

Options

There are no specific options for this rule, yet it uses the general settings.