Skip to content

feat(lint): add icon color variable policies#83

Merged
alexey1312 merged 2 commits into
mainfrom
codex-icon-color-variable-lint
Jun 2, 2026
Merged

feat(lint): add icon color variable policies#83
alexey1312 merged 2 commits into
mainfrom
codex-icon-color-variable-lint

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

Summary

  • Add optional lint-only PKL config loading via adjacent lint.pkl or --lint-config.
  • Add icon-color-variables rule for checking selected icon entries against expected Figma Variables.
  • Resolve variable names from main config sources and icon file variables without duplicating variable file IDs in normal configs.
  • Make unbound paint enforcement opt-in via requireBound to avoid noisy migration checks.

Verification

  • ./bin/mise run test:filter Lint
  • ./bin/mise run test:filter PKLEvaluatorTests
  • ./bin/mise run lint
  • ./bin/mise run build:release
  • Oymyakon check: ./bin/mise run figma:lint -- --rules icon-color-variables --rate-limit 25 -> passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Sources/ExFigCLI/Lint/Rules/IconColorVariablesLintRule.swift Outdated
Comment thread Sources/ExFigCLI/Lint/Rules/IconColorVariablesLintRule.swift Outdated
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.
@alexey1312 alexey1312 merged commit b7a470e into main Jun 2, 2026
4 checks passed
@alexey1312 alexey1312 deleted the codex-icon-color-variable-lint branch June 2, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant