no-abbreviations
Names that other people and tools read use full words, not abbreviations.
- Severity
- warning
- Fixable
- no
Checks
Section titled “Checks”- The names it reads: tokens’ names (
--t-*), where they’re declared or registered with@property; component variables’ names (--c-*), where their own component uses them; component classes, each place a selector writes them; and the names and values of thedata-*attributes a selector or a scope’s root writes, parts’ and slots’ names included. - Each word of a name is checked against a deny list of known abbreviations, mostly Tailwind’s vocabulary:
bg,fg,clr,txt,btn,prim,sec,hov,dis,brd,pad,mrg,sp,w,h,sz,lbl,hdr,itmand others. Words are split at hyphens, underscores and camel case, so.NavItmisNavandItm. - The message suggests the whole name with each word in full, in the abbreviation’s case:
--c-card-padbecomes--c-card-padding,.NavItmbecomes.NavItem. - An abbreviation with more than one common meaning gets its candidates, not one guess:
acc(accent, accordion, account),sec(secondary, section, second),sel(selected, select, selection),desc(description, descending) anddis(disabled, display).[data-sort="desc"]is told:Write the full word, such as "description" or "descending". padis reported only in a custom property’s name (--c-card-pad). In a class or an attribute it’s often the noun:.signature-pad,.number-pad.- A component variable is its component’s, so its name is checked only where that component uses it: read or written on one of its elements (
.card { padding: var(--c-card-pad, 0); }), or registered with@propertyin the file that has its root block. A consumer setting it (.page { --c-card-pad: 0; }, or--c-button-gapon a slot) isn’t told to rename someone else’s API. Its own component is the one whose name it starts with, and that name is checked where the class or the attribute writes it:--c-signature-pad-coloron.signature-padis checked fromcoloron. - Never reported: HTML element names (
nav,img,svg,li), CSS’s own words and units (min,max,calc,rgb,px), established terms (id,url,aria,ui), coordinates (x,y), numbers, and words the deny list doesn’t know. A word on the list inside a longer word (padinpadding) is a different word. - T-shirt sizes (
xs,sm,md,lg,xl,2xl) are allowed unlesssizesis"full". Then each is suggested in CSS’s own words for font sizes:small,medium,large,x-small,x-large,xx-large. - Not checked: privates’ names, unless
privatesistrue; state, part and query variables, whose names come from their property, part or component; other classes than a component’s; the platform’s attributes (type,aria-*,dir) and their values; the attributesstatefulcss.confignames (data-component,data-part,data-slot,data-theme), whose values are still checked; a value matched in part with^=,$=,*=or|=([data-file$=".txt"]) and the value of an attribute whose name ends inlang,localeorlanguage([data-lang="bg"]), which are data, not names; comments inside a selector or a scope’s root; utilities, and what:deep(),:global()or:slotted()selects; a name SCSS or Less builds with interpolation. - One finding for each written name. A selector list writes a declaration once; a class written in two selectors is reported in both.
Full words are a Convention: readability wins over typing a few letters less. Assistants abbreviate by habit, because Tailwind made bg, sm and px the most common styling vocabulary, so the default decides what most Stateful CSS code looks like. A deny list, not a dictionary, so a brand name or a made-up word is never reported: the rule reports only what it knows is an abbreviation.
An abbreviation in a token’s name
Section titled “An abbreviation in a token’s name”Reported:
[data-theme="default"] { --t-bg-accent: blue;}Fixed:
[data-theme="default"] { --t-color-background-accent: blue;}An abbreviation in a component’s class
Section titled “An abbreviation in a component’s class”Reported:
.btn { display: flex;}Fixed:
.button { display: flex;}An abbreviation in a component variable’s name
Section titled “An abbreviation in a component variable’s name”Reported:
.card { padding: var(--c-card-pad, var(--t-space-1));}Fixed:
.card { padding: var(--c-card-padding, var(--t-space-1));}An attribute name and an attribute value the CSS selects on
Section titled “An attribute name and an attribute value the CSS selects on”Reported:
.button { &[data-btn-emph="prim"] { color: red; }}Fixed:
.button { &[data-emphasis="primary"] { color: red; }}An abbreviation in a private’s name, with privates: true
Section titled “An abbreviation in a private’s name, with privates: true”Reported:
.card { --_pad: var(--t-space-1);}Fixed:
.card { --_padding: var(--t-space-1);}A T-shirt size, with sizes: "full"
Section titled “A T-shirt size, with sizes: "full"”Reported:
.button { &[data-size="sm"] { padding: 0; }}Fixed:
.button { &[data-size="small"] { padding: 0; }}Not reported
Section titled “Not reported”.header { --c-nav-link-color: red; }: HTML element names.--c-tooltip-offset-x,--t-space-2: coordinates and numbers.--c-card-max-width,--t-space-px: CSS’s own words and units.[data-size="sm"],--t-space-md,--t-font-size-2xl: T-shirt sizes, by default..card { --_pad: var(--t-space-1); }: private names, by default.@layer utilities { .btn-sm { … } }: utilities..field[aria-label="Clear msg"]: the platform’s attributes..signature-pad,.number-pad:padas a noun, outside a custom property’s name..signature-pad { --c-signature-pad-color: black; }:padin the component’s own name..page { --c-card-pad: var(--t-space-1); }: a consumer setting the Card’s variable. The Card’s file, which reads it, is where it’s reported.[data-file$=".txt"],[data-lang="bg"]: a value matched in part, and a language code..card/* old [data-btn=prim] */:hover: a comment inside a selector.
Options
Section titled “Options”ignoreWords: words allowed in any name, such as a product’s own short name. Each is a word, a/regex/(or/regex/i) string, or a regular expression in a JavaScript config, matched against one word of a name:ignoreWords: ["btn"]allows.btnand--c-btn-gap. A word is matched as written and in lowercase.privates:truechecks privates’ names (--_*) too.falseby default.sizes:"short"(the default) allows T-shirt sizes;"full"reports them.
It reads the attribute names componentAttribute, partAttribute, slotAttribute and themeAttribute from statefulcss.config. A utility is a class block in @layer utilities.