fix(figma-coverage): stop flagging Figma slot nodes as non-Blade - #3934
Merged
Conversation
Figma's SLOT node type was in none of the plugin's type lists, so it fell into the catch-all branch and drew a "Not created using Blade Components/Tokens" marker on every slot. That branch only draws the rectangle and never touches the non-Blade counters, so the coverage card kept reporting 100% while the file showed markers. Slots also counted toward totalLayers, quietly lowering the score on any file below 100%. Skip SLOT in both places, and treat crossing a slot as proof that a node is designer content: isInsideBladeComponent walked up to the nearest instance and exempted anything under a Blade one, which wrongly excused raw frames dropped into a Blade slot. Slots are the one place where an instance's descendants are authored by the designer. Also roll up patternsUsed from the slot recursion, which aggregated every other metric but that one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Contributor
|
|
Collaborator
🛡️ Coverage ReportSummaryFull Coverage Details |
Contributor
|
🤖 Slash AI Review has been triggered. View execution logs |
saurabhdaware
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reported issue: a file at 100% Blade coverage still showed a non-Blade marker reading
Not created using Blade Components/Tokens, Type: Slot, Name: slot-content.Figma's
SLOTnode type appears in none of the plugin's type lists, so it fell into the catch-all branch atmain.ts:601and drew a marker on every slot. That branch only draws the rectangle — it never incrementsnonBladeComponents/nonBladeTextStyles/nonBladeColorStyles. With all three at zero the coverage calculation short-circuits to a hardcoded100, so the card and the markers disagreed.Slots also passed the
totalLayerscheck, quietly lowering the score on any file that wasn't already at 100%.Changes
SLOTin coverage. Added toNODES_SKIP_FROM_COVERAGE, which removes both the marker and the layer-count inflation. Slot contents are still traversed and measured — the list only governs the catch-all highlight and the layer count, not traversal.isInsideBladeComponentwalked up to the nearest ancestorINSTANCEand exempted anything beneath a Blade one. For a raw frame dropped into a Card slot that nearest instance is the Card, so it was wrongly excused as Blade chrome. Crossing aSLOTnow proves the node is designer-authored. Its docblock premise — "Figma does not allow adding or removing children of an instance" — is exactly what slots invalidate.patternsUsedfrom slots. The slot recursion aggregated every metric except this one, so patterns inside a slot never reached the card.@figma/plugin-typings@1.107.0-beta.2has noSlotNodeand no'SLOT'in its type union, so the runtime type is compared as a string via a sharedSLOT_NODE_TYPEconstant. A typings bump would let both comparisons become type-safe.Additional Information
Expect coverage numbers to fall on some files. Slots holding hand-rolled frames previously reported clean. That is the fix working, but it will read as a regression to anyone watching their score.
Needs manual verification in Figma before merge. The second change assumes slot content is parented under the
SLOTnode. If Figma parents it as a sibling instead, the check never fires and raw frames in slots stay unflagged. Worth testing directly: drop a plain frame with a fill into a Card slot and confirm it now reports "You might want to use Card with Slot…".Known gap, deliberately out of scope. Hardcoded fill colours on nodes inside Blade instances are still never flagged: traversal stops at every Blade instance, and the
overridescheck watchesletterSpacing,textStyleId,fontName,fontSize,lineHeight,textCaseandcornerRadius— but notfills/fillStyleId. So a raw hex on text inside a Blade component scores as clean. Tracked separately; the fix needs care to avoid flagging legitimate recolouring through Blade colour variables.Component Checklist
🤖 Generated with Claude Code