Skip to content

Lint

Run design quality and accessibility checks.

Type reference
// Lint runs automated design quality and accessibility checks on a node tree.
// ---
// Rules: "all" (default), or filter by category or specific rule names.
// Category meta-rules (expand to all rules in that category):
// "component" — component property binding checks
// "composition" — layout and positioning checks
// "token" — design token / style usage checks
// "naming" — layer naming checks
// "wcag" / "accessibility" — all WCAG accessibility checks
// ---
// Severity levels (output is sorted by severity, highest first):
// "error" — definite bug, must fix
// "unsafe" — likely causes layout/accessibility problems
// "heuristic" — probably worth fixing, context-dependent
// "style" — opinionated, nice-to-have (leaf nodes, decorative elements often downgraded here)
// Context-aware: leaf nodes (text, shapes, small frames) are treated differently from containers.
// Small labels with HUG sizing, leaf nodes on cross-axis — downgraded to "style" instead of "heuristic".
// Per-finding severity overrides appear on individual nodes when context changes the default.
// ---
// Component rules [component]:
// "no-text-property" — component text not exposed as editable property [heuristic]
// "component-bindings" — unbound text, orphaned properties, unexposed nested text [heuristic; orphaned→unsafe, nested→style]
// Composition rules [composition]:
// "no-autolayout" — frames with manually positioned children [heuristic; leaf-only containers→style]
// "overlapping-children" — children stacked at same position [heuristic]
// "shape-instead-of-frame" — shapes used as containers [style]
// "fixed-in-autolayout" — FIXED-size children in auto-layout parents [heuristic]
// "unbounded-hug" — HUG on both axes [unsafe; short leaf text→style]
// "hug-cross-axis" — HUG on cross-axis of constrained parent [heuristic; leaf nodes→style]
// "empty-container" — empty frames, excludes SLOT nodes [style]
// Token rules [token]:
// "hardcoded-color" — colors not using styles or variables [heuristic]
// "hardcoded-token" — numeric values not bound to FLOAT variable [heuristic]
// "no-text-style" — text without a text style [heuristic]
// Naming rules [naming]:
// "default-name" — default names like "Frame 1" [style]
// "stale-text-name" — text node name doesn't match content [style]
// Accessibility rules [wcag]:
// "wcag-contrast" — AA contrast ratio [unsafe]
// "wcag-contrast-enhanced" — AAA contrast ratio [style]
// "wcag-non-text-contrast" — non-text 3:1 contrast [heuristic]
// "wcag-target-size" — targets below 24x24px [unsafe]
// "wcag-text-size" — text below 12px [unsafe]
// "wcag-line-height" — line height below 1.5x [style]
// ---
// maxDepth limits how deep the tree traversal goes (default: 10). maxFindings caps total findings (default: 50).
// fix: auto-converts frames to auto-layout. Use after lint.check identifies "no-autolayout" issues.

2 methods available.

Run design linter on a node tree

ParameterTypeRequiredDescription
nodeIdstringNode ID to lint. If omitted: 1 selected node → lints that node, 2+ selected → lints entire page (not the selection), 0 selected → error. Always pass nodeId explicitly for reliable targeting.
rulesstring[]Rules to run. Default: ["all"]. Categories: "component", "composition", "token", "naming", "wcag"/"accessibility". Or specific rule names.
maxDepthnumberMax tree depth (default: 10)
maxFindingsnumberMax findings (default: 50)
minSeverity"error" | "unsafe" | "heuristic" | "style" | "verbose"Minimum severity to report (default: style). Set to 'verbose' to include AAA contrast and line-height checks.
skipInstancesbooleanSkip instance internals — findings inside instances are owned by the component (default: true)

Response

FieldTypeDescription
nodeIdstring
nodeNamestring
categoriesobject[]Sorted by severity (error > unsafe > heuristic > style)
rulestring
severitystringerror | unsafe | heuristic | style
categorystringcomponent | composition | token | accessibility | naming
countnumber
fixstring
nodesobject[]
idstring
namestring
severitystringPer-finding override when context changes the default
warningstring

Auto-fix frames to auto-layout

ParameterTypeRequiredDescription
itemsobject[]Array of {nodeId, layoutMode?, itemSpacing?}
nodeIdstringFrame node ID
layoutMode"VERTICAL" | "HORIZONTAL"Direction (default: auto-detected)
itemSpacingnumberSpacing between children
depthnumberResponse detail for fixed nodes: omit for stubs, 0=properties, -1=full tree

Response

FieldTypeDescription
resultsany[]Array of "ok" or {error} per item