Getting Started
Scan your codebase for hardcoded colors, spacing, font sizes, and border-radius values that should use design tokens.
The Problem
According to analysis of 5,000+ enterprise repositories, 74% of React components contain at least three hardcoded color or spacing values that bypass the design system. ds-lint finds them.
Installation
# Run directly (no install) npx ds-lint src/ # Or install globally npm i -g ds-lint
Usage
# Basic scan ds-lint src/ # With token definitions (enables suggestions) ds-lint src/ --tokens tokens.css # Markdown report for PR ds-lint src/ --format markdown --out report.md # Strict mode for CI ds-lint src/ --tokens tokens.css --strict
CLI Options
What It Detects
#hex, rgb(), rgba(), hsl(), hsla(), named CSS colors (red, blue, etc.)
padding, margin, gap, top/right/bottom/left, width/height in px/rem
font-size, line-height, letter-spacing in px/rem
border-radius in px/rem (skips 0px)
Scans: .js .jsx .ts .tsx .css .scss .vue .svelte
Skips: node_modules, dist, build, .next, .git, CSS variable declarations
Token Sources
Provide a token file with --tokens to get replacement suggestions:
CSS custom properties
:root {
--color-primary: #3b82f6;
--space-4: 16px;
--text-sm: 14px;
--radius-md: 8px;
}JSON tokens (DTCG compatible)
{
"color": {
"primary": { "$value": "#3b82f6" }
},
"space": {
"sm": { "$value": "8px" },
"md": { "$value": "16px" }
}
}Markdown tables
Works with output from figma-to-design-md — token tables are parsed automatically.
Output Example
Inline Ignore
Add a comment on the line above to skip specific values:
/* ds-lint-ignore */
.special-case { color: #ff0000; }
// ds-lint-disable
const borderColor = "#333";CI Integration
# GitHub Actions - name: Check design tokens run: npx ds-lint src/ --tokens tokens.css --strict # Generate PR report - name: DS Lint Report run: npx ds-lint src/ --tokens tokens.css --format markdown --out ds-lint.md
--strict exits with code 1 when violations are found, failing the CI step.
Pipeline
ds-lint fits between token definition and adoption tracking: