Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
This reverts commit 9dbd56271e.
77 lines
1.9 KiB
JSON
77 lines
1.9 KiB
JSON
{
|
|
"$schema": "../schemas/rule.schema.json",
|
|
"id": "spacing",
|
|
"version": "1.0.0",
|
|
"name": "Spacing Token Rules",
|
|
"description": "Rules for consistent spacing using design tokens",
|
|
"category": "tokens",
|
|
"severity": "warning",
|
|
"rules": [
|
|
{
|
|
"id": "no-arbitrary-spacing",
|
|
"name": "No Arbitrary Spacing Values",
|
|
"description": "Spacing must use token scale (4px increments), not arbitrary values",
|
|
"severity": "warning",
|
|
"patterns": {
|
|
"forbidden": [
|
|
"margin:\\s*[0-9]+px",
|
|
"padding:\\s*[0-9]+px",
|
|
"gap:\\s*[0-9]+px"
|
|
],
|
|
"allowed": [
|
|
"var\\(--spacing-[a-z0-9]+\\)",
|
|
"\\$spacing-[a-z0-9]+",
|
|
"spacing\\.[a-z0-9]+"
|
|
]
|
|
},
|
|
"exceptions": [
|
|
"0",
|
|
"0px",
|
|
"auto",
|
|
"inherit"
|
|
]
|
|
},
|
|
{
|
|
"id": "spacing-scale",
|
|
"name": "Use Spacing Scale",
|
|
"description": "Only use values from the defined spacing scale",
|
|
"severity": "error",
|
|
"validation": {
|
|
"type": "scale-check",
|
|
"allowedValues": [0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 80, 96, 128]
|
|
}
|
|
},
|
|
{
|
|
"id": "consistent-component-spacing",
|
|
"name": "Component Internal Spacing",
|
|
"description": "Components should use consistent internal spacing patterns",
|
|
"severity": "info",
|
|
"guidelines": [
|
|
"Use spacing.xs (4px) for tight groupings",
|
|
"Use spacing.sm (8px) for related elements",
|
|
"Use spacing.md (16px) for section separation",
|
|
"Use spacing.lg (24px) for major sections",
|
|
"Use spacing.xl (32px+) for page-level separation"
|
|
]
|
|
}
|
|
],
|
|
"tokens": {
|
|
"required": [
|
|
"spacing.xs",
|
|
"spacing.sm",
|
|
"spacing.md",
|
|
"spacing.lg",
|
|
"spacing.xl"
|
|
],
|
|
"scale": {
|
|
"xs": "4px",
|
|
"sm": "8px",
|
|
"md": "16px",
|
|
"lg": "24px",
|
|
"xl": "32px",
|
|
"2xl": "48px",
|
|
"3xl": "64px"
|
|
}
|
|
}
|
|
}
|