Skip to content

Files

Latest commit

 

History

History
71 lines (47 loc) · 1.44 KB

font-family-no-duplicate-names.md

File metadata and controls

71 lines (47 loc) · 1.44 KB

Pattern: Duplicate font family name

Issue: -

Description

This rule checks the font and font-family properties.

This rule ignores $sass, @less, and var(--custom-property) variable syntaxes.

Caveat: This rule will stumble on unquoted multi-word font names and unquoted font names containing escape sequences. Wrap these font names in quotation marks, and everything should be fine.

Examples

The following patterns are considered violations:

a { font-family: serif, serif; }
/**              ↑      ↑
 * These font family names */
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 violations:

a { font-family: Times, serif; }
a { font: 1em "Arial", "sans-serif", sans-serif; }
a { font: normal 14px/32px -apple-system, BlinkMacSystemFont, sans-serif; }

Configuration

ignoreFontFamilyNames: ["/regex/", "string"]

Given:

["/^Some Font /", "monospace"]

The following patterns are not considered violations:

font-family: monospace, monospace
font-family: "Some Font Family", "Some Font Family", monospace

Further Reading