You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(lint): eliminate silent failures in PathDataLengthRule and improve test coverage
- Emit warning diagnostic instead of silently returning empty array when URL parsing fails
- Emit warning when Figma returns nil SVG URL for components (previously silently dropped)
- Include icon names in batch failure diagnostics for better debuggability
- Extract validateParsedSVG as internal method for unit testability
- Add tests: components API failure, RTL variant filtering, variant deduplication,
nil SVG URL handling, pathData critical error (happy path), short pathData (no error)
- Update LintEngine rule count test from 8 to 9
- Add SVGKit dependency to ExFigTests for direct ParsedSVG construction
- Document lint rule testability patterns in CLAUDE.md
Copy file name to clipboardExpand all lines: CLAUDE.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -341,6 +341,8 @@ Uses `FigmaAPI.Client.request(SomeEndpoint(...))` directly (no convenience metho
341
341
- Lint rules checking component names MUST use `comp.iconName` (not `comp.name`) — for variants, `name` is the variant value, not the icon name
342
342
- Deduplicate variants by `containingComponentSet.nodeId` before grouping — multiple variants of one set are NOT duplicates
343
343
- Adding error handling to `check()` increases cyclomatic complexity — extract per-entry logic into private methods
344
+
- For unit-testable validation logic in lint rules, use `internal` (not `private`) methods — allows `@testable import` testing without network calls (e.g., `validateParsedSVG`)
345
+
-`LintEngineTests.defaultEngineHasAllRules` checks exact set of rule IDs — must add new rule ID when registering in `LintEngine.default`
344
346
-`NodesEndpoint` supports `geometry: .paths` parameter — returns `fillGeometry`/`strokeGeometry` with SVG path data on vector nodes. **Not suitable for pathData validation** — Figma's SVG export flattens masks/booleans into different paths than raw geometry
345
347
-`PathDataLengthRule` checks ALL platform icon entries (iOS/Android/Flutter/Web), deduplicates by fileId+frame+page. Downloads SVGs via `ImageEndpoint` + `URLSession`, parses with `SVGParser`, validates with `PathDataValidator`. Only reports critical >32,767 byte errors (800-char threshold removed as too noisy). Groups by fileId, batches ImageEndpoint by 50, parallelizes SVG downloads (max 10 concurrent) and fileIds
| JSON output empty in quiet |`ui.info()` suppressed when `outputMode == .quiet` — machine-readable output (JSON) must use `TerminalOutputManager.shared.print()` directly |
518
520
|`Bundle.module` in tests | SPM test targets without declared resources don't have `Bundle.module` — use `Bundle.main` or temp bundle |
519
521
| SwiftFormat breaks `::` syntax | SwiftFormat 0.60.1+ required for Swift 6.3 module selectors (`FigmaAPI::Client`) |
522
+
|`SVGKit` types in tests | Add `.product(name: "SVGKit", package: "swift-svgkit")` to ExFigTests dependencies in Package.swift for direct `ParsedSVG`/`SVGPath` construction |
520
523
|`fillGeometry` wrong pathData |`fillGeometry` returns raw node geometry, NOT the SVG export result. Figma flattens masks/booleans into different paths. Use `ImageEndpoint` SVG download + `SVGParser` for accurate pathData validation |
521
524
|`NodesEndpoint` no `fillGeometry`| Requires `geometry: .paths` param (swift-figma-api 0.4.0+). Fields are `nil` without it. Useful for geometry inspection but NOT for pathData length validation |
522
525
| MCP SDK 0.12.0 breaking |`.text` has 3 associated values — pattern match as `.text(text, _, _)`; `GetPrompt.arguments` is `[String: String]?` now |
0 commit comments