Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
This reverts commit 9dbd56271e.
76 lines
1.9 KiB
JSON
76 lines
1.9 KiB
JSON
{
|
|
"$schema": "../schemas/rule.schema.json",
|
|
"id": "typography",
|
|
"version": "1.0.0",
|
|
"name": "Typography Rules",
|
|
"description": "Rules for consistent typography using design tokens",
|
|
"category": "tokens",
|
|
"severity": "warning",
|
|
"rules": [
|
|
{
|
|
"id": "use-typography-scale",
|
|
"name": "Use Typography Scale",
|
|
"description": "Font sizes must use the defined typography scale",
|
|
"severity": "error",
|
|
"patterns": {
|
|
"forbidden": [
|
|
"font-size:\\s*[0-9]+px",
|
|
"fontSize:\\s*[0-9]+"
|
|
],
|
|
"allowed": [
|
|
"var\\(--font-size-[a-z]+\\)",
|
|
"\\$font-size-[a-z]+",
|
|
"typography\\.[a-z]+"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "semantic-text-elements",
|
|
"name": "Use Semantic Text Elements",
|
|
"description": "Use appropriate heading levels and text components",
|
|
"severity": "warning",
|
|
"validation": {
|
|
"headingOrder": true,
|
|
"maxH1PerPage": 1,
|
|
"noSkippedLevels": true
|
|
}
|
|
},
|
|
{
|
|
"id": "line-height-consistency",
|
|
"name": "Consistent Line Heights",
|
|
"description": "Line heights should match the typography scale",
|
|
"severity": "info",
|
|
"guidelines": [
|
|
"Use lineHeight.tight (1.25) for headings",
|
|
"Use lineHeight.normal (1.5) for body text",
|
|
"Use lineHeight.relaxed (1.75) for long-form content"
|
|
]
|
|
}
|
|
],
|
|
"tokens": {
|
|
"required": [
|
|
"typography.h1",
|
|
"typography.h2",
|
|
"typography.h3",
|
|
"typography.body",
|
|
"typography.small",
|
|
"typography.caption"
|
|
],
|
|
"scale": {
|
|
"xs": "12px",
|
|
"sm": "14px",
|
|
"base": "16px",
|
|
"lg": "18px",
|
|
"xl": "20px",
|
|
"2xl": "24px",
|
|
"3xl": "30px",
|
|
"4xl": "36px",
|
|
"5xl": "48px"
|
|
},
|
|
"fontFamilies": {
|
|
"sans": "Inter, system-ui, sans-serif",
|
|
"mono": "JetBrains Mono, monospace"
|
|
}
|
|
}
|
|
}
|