fix(tests): Correct Figma ingest test
This commit is contained in:
75
packages/dss-rules/rules/colors.json
Normal file
75
packages/dss-rules/rules/colors.json
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"$schema": "../schemas/rule.schema.json",
|
||||
"id": "colors",
|
||||
"version": "1.0.0",
|
||||
"name": "Color Token Rules",
|
||||
"description": "Rules for color token usage and compliance",
|
||||
"category": "tokens",
|
||||
"severity": "error",
|
||||
"rules": [
|
||||
{
|
||||
"id": "no-hardcoded-colors",
|
||||
"name": "No Hardcoded Colors",
|
||||
"description": "All colors must use design tokens, not hardcoded hex/rgb values",
|
||||
"severity": "error",
|
||||
"patterns": {
|
||||
"forbidden": [
|
||||
"#[0-9a-fA-F]{3,8}",
|
||||
"rgb\\([^)]+\\)",
|
||||
"rgba\\([^)]+\\)",
|
||||
"hsl\\([^)]+\\)",
|
||||
"hsla\\([^)]+\\)"
|
||||
],
|
||||
"allowed": [
|
||||
"var\\(--[a-z-]+\\)",
|
||||
"\\$[a-z-]+",
|
||||
"colors\\.[a-z]+",
|
||||
"theme\\.[a-z]+"
|
||||
]
|
||||
},
|
||||
"exceptions": [
|
||||
"*.test.*",
|
||||
"*.spec.*",
|
||||
"**/fixtures/**"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "semantic-color-naming",
|
||||
"name": "Semantic Color Naming",
|
||||
"description": "Colors must use semantic names (primary, error) not descriptive (blue, red)",
|
||||
"severity": "warning",
|
||||
"validation": {
|
||||
"type": "naming-convention",
|
||||
"pattern": "^(primary|secondary|accent|success|warning|error|info|neutral|background|foreground|border|muted)(-[a-z]+)?$"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "contrast-ratio",
|
||||
"name": "Minimum Contrast Ratio",
|
||||
"description": "Text/background combinations must meet WCAG AA standards",
|
||||
"severity": "error",
|
||||
"validation": {
|
||||
"type": "contrast-check",
|
||||
"minRatio": 4.5,
|
||||
"largeTextRatio": 3.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"tokens": {
|
||||
"required": [
|
||||
"colors.primary",
|
||||
"colors.secondary",
|
||||
"colors.background",
|
||||
"colors.foreground",
|
||||
"colors.border",
|
||||
"colors.error",
|
||||
"colors.success",
|
||||
"colors.warning"
|
||||
],
|
||||
"optional": [
|
||||
"colors.muted",
|
||||
"colors.accent",
|
||||
"colors.info"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user