You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a {
/* Duplicate family name */font-family: Arial, Arial, sans-serif;
/* Quoted and unquoted names refer to the same family */font-family:"Arial", Arial, sans-serif;
/* Also checked in the `font` shorthand */font:16px Verdana, Verdana, sans-serif;
}
The stylelint rule warns that it stumbles on unquoted multi-word font names and names containing escape sequences. This implementation can avoid that limitation: within each comma-separated segment, all consecutive identifiers form a single family name per the grammar (joined with single spaces), and escape sequences can be normalized before comparison, so Times New Roman and "Times New Roman" compare as equal.
Complements the existing font-family-fallbacks rule. Its helpers (generic font list, CSS-wide keyword checks, font/font-family handling) are currently private to that rule's module - if extracting them to the shared util.js is acceptable, both rules could reuse them.
Rule details
Disallow duplicate names within font families.
What type of rule is this?
Warns about a potential problem
Example code
Prior Art
Participation
AI acknowledgment
Additional comments
"Arial"is equivalent toarial).font-family: monospace, monospaceis a known intentional browser hack (Please explain monospace, monospace one more time :) necolas/normalize.css#519 (comment)), so anallowFontFamiliesarray option should be included as an escape hatch. Stylelint covers the same need withignoreFontFamilies.Times New Romanand"Times New Roman"compare as equal.font-family-fallbacksrule. Its helpers (generic font list, CSS-wide keyword checks,font/font-familyhandling) are currently private to that rule's module - if extracting them to the sharedutil.jsis acceptable, both rules could reuse them.