feat(lint): add icon color variable policies#83
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new icon-color-variables lint rule to verify that icon fills and strokes are bound to configured Figma Variables, along with support for loading optional lint-only overlay configurations (lint.pkl). It updates the CLI, MCP tool definitions, and PKL schemas, and adds corresponding unit tests. The review feedback correctly identifies a limitation in resolveVariableSource where expected variables are assumed to reside in a single file; in larger design systems, these are often distributed across multiple files. Refactoring the policy check to merge variables from all candidate files and subsequently removing the redundant helper method will resolve this issue and improve the robustness of the lint rule.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Address PR review feedback on the icon-color-variables rule: - Merge variable name indices across ALL candidate files instead of requiring one file to hold every expected variable; binding validation always runs against the merged index, so a degraded/failed variable fetch or a renamed variable no longer silently skips the whole check. - Treat config mistakes (selector matching nothing, empty allow-list, no component matched, expected variables absent) as .warning, not a hard .error that fails CI. - Surface empty fileId with a precise message before resolution. - Sample components with prefix(50) to respect NodesEndpoint rate limits. - Skip fully transparent subtrees (opacity == 0); O(n) lookup -> dict. - Wrap the generated policy in IconColorPolicy (failable init rejects an empty allow-list, single allowed(for:) overlap rule); fix description to reflect that binding is opt-in via requireBound. Tests: - Add fileId-aware MockClient overloads (setResponse/setError for:fileId:) so cross-file resolution can be tested per file. - Cover all API-failure paths, empty-fileId, multiple/nested fills, transparent skip, RTL skip, unbound stroke, and unit-test variableLookupKeys + IconColorPolicy. Rule suite: 10 -> 26 tests. Clarify Lint.pkl field comments and capture session learnings in pkl-codegen / troubleshooting / lint-patterns rule files.
Summary
Verification