font-family-no-duplicate-names
Disallow duplicate names within font families.
a { font-family: serif, serif; }/** ↑ ↑ * These font family names */Use this rule to avoid font family names that can never be chosen. Browsers try families in order, so a repeat can’t match when the first didn’t.
This rule checks the font and font-family properties.
This rule ignores $sass, @less, and var(--custom-property) variable syntaxes.
This rule supports 1 message argument: the duplicate font family name.
Options
Section titled “Options”{ "font-family-no-duplicate-names": true}The following patterns are considered problems:
a { font-family: 'Times', Times, serif; }a { font: 1em "Arial", 'Arial', sans-serif; }a { font: normal 14px/32px -apple-system, BlinkMacSystemFont, sans-serif, sans-serif; }The following patterns are not considered problems:
a { font-family: Times, serif; }a { font: 1em "Arial", "sans-serif", sans-serif; }a { font: normal 14px/32px -apple-system, BlinkMacSystemFont, sans-serif; }Optional secondary options
Section titled “Optional secondary options”ignoreFontFamilyNames
Section titled “ignoreFontFamilyNames”{ "ignoreFontFamilyNames": ["array", "of", "font-family-names", "/regex/"] }Given:
{ "font-family-no-duplicate-names": [ true, { "ignoreFontFamilyNames": ["/^My Font /", "monospace"] } ]}The following patterns are not considered problems:
font-family: monospace, monospacefont-family: "My Font Family", "My Font Family", monospace