fix(linter): support grouped color tokens#68
Conversation
|
Added one final hardening commit after a deeper edge-case audit. The update adds collision detection for cases where a grouped color token would flatten into an already-defined token name, for example: colors:
utility-info-50: "#111111"
utility-info:
50: "#222222"This now emits a clear lint diagnostic instead of silently overwriting one value. I also added tests for collision handling and invalid grouped color values such as booleans, arrays, and bare numbers. Validation:
Note: the root Turbo build still appears blocked by the existing missing root |
|
Hey @Arshgill01. Thank you for taking the time. We are currently working out the syntax and behavior, tracking in #66. We need to land that first before we can finalize the implementation. Let me ping you when we have a solution. |
Summary
Adds support for nested color groups under
colorswhile preserving the existing flat color-token behavior.This allows DESIGN.md files to define color scales like:
instead of requiring all tokens to be manually flattened:
What changed
Added a recursive
ParsedColorValuetype for parsed color values.Updated parser/model typing to allow nested color groups without falling back to
any.Added grouped color flattening in the model layer.
Preserved flat token keys such as
utility-info-50.Added symbol-table support for both:
{colors.utility-info-50}{colors.utility-info.50}Updated the DESIGN.md spec documentation for grouped color tokens.
Added tests for grouped color parsing, invalid nested color diagnostics, component references, Tailwind export, and DTCG export.
Behavior
Grouped color input:
is normalized internally/exported as:
This keeps Tailwind-friendly output while still allowing object-path token references.
Validation
bun installbun testbun run buildfrompackages/cliResult: all 239 tests pass and the package builds successfully.
Notes
DTCG and Tailwind exports intentionally preserve flattened token names such as
utility-info-50. This avoids data loss and maintains compatibility with the existing flat color-token model.Fixes #66.