Skip to content

feat(lint): Add configurable rtlActiveValues and invalid-rtl-variant-value rule#81

Merged
alexey1312 merged 4 commits intomainfrom
feat/rtl-active-values-lint
Apr 7, 2026
Merged

feat(lint): Add configurable rtlActiveValues and invalid-rtl-variant-value rule#81
alexey1312 merged 4 commits intomainfrom
feat/rtl-active-values-lint

Conversation

@alexey1312
Copy link
Copy Markdown
Collaborator

Description

  • Add rtlActiveValues PKL config field to control which variant values mean "active RTL" (default: ["On"]), replacing hardcoded "On" check
  • Add invalid-rtl-variant-value lint rule that validates RTL variant property values against configured active values and their known counterparts (On↔Off, true↔false, True↔False, Yes↔No, 0↔1)
  • Thread rtlActiveValues through all platform entry bridges, loader configs, context implementations, and ImageLoaderBase
  • Update shouldSkipAsRTLVariant to accept configurable active values parameter

Additional notes

  • Backward-compatible: nil defaults to ["On"], matching previous behavior
  • Lint rule uses Components API only (no ImageEndpoint), deduplicates entries by fileId+frame+page+rtlProperty+activeValues
  • validateRTLValues and validValues(for:) are internal for direct unit testing without network mocks

…value rule

Add `rtlActiveValues` PKL config field (default `["On"]`) that controls
which RTL variant values are skipped during export. Previously hardcoded
to `"On"`, now designers using `true/false` or other conventions can
configure this per-entry.

New lint rule `invalid-rtl-variant-value` validates that RTL variant
property values match the configured active values and their known
counterparts (On↔Off, true↔false, True↔False, Yes↔No, 0↔1).

Also improves the empty component error message to show both the icon
name and variant name: `car (RTL=true)` instead of just `RTL=true`.
- Fix hardcoded "RTL=On" in ImageLoaderBase log message and comments
- Include rtlActiveValues in dedup key for InvalidRTLVariantValueRule
- Add tests for shouldSkipAsRTLVariant with custom activeValues
- Add rtlActiveValues pass-through assertion in IconsLoaderConfigTests
- Test validValues with custom value not in knownPairs
- Fix doc comment accuracy in InvalidRTLVariantValueRule
- Improve Configuration.md example with separate default/alternative
Copy link
Copy Markdown

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

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 the InvalidRTLVariantValueRule to validate RTL variant property values in Figma against a configurable list of active values (rtlActiveValues). The changes span the configuration schemas, the export pipeline across all platforms, and include comprehensive tests and documentation. Review feedback identifies several improvement opportunities in the lint rule's logic: it should correctly handle disabled RTL detection when rtlProperty is null, extend validation to include image entries, and align its frame/page name fallbacks with the exporters. A performance optimization was also suggested to pre-calculate valid value sets outside the component iteration loop.

Comment thread Sources/ExFigCLI/Lint/Rules/InvalidRTLVariantValueRule.swift Outdated
Comment thread Sources/ExFigCLI/Lint/Rules/InvalidRTLVariantValueRule.swift
…allbacks

- Skip entries with nil rtlProperty (user explicitly disabled RTL)
- Collect both icons and images entries for validation
- Apply common.icons/images frame/page name fallbacks
- Pre-calculate validValues outside component loop
- Add test for nil rtlProperty skipping
@alexey1312 alexey1312 merged commit 9596b2a into main Apr 7, 2026
4 checks passed
@alexey1312 alexey1312 deleted the feat/rtl-active-values-lint branch April 7, 2026 07:53
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