Skip to content

tools/lint/v0.1.6 — ID-context Ref + chain form analyzer

Choose a tag to compare

@jackielii jackielii released this 25 May 11:31

Summary

Matches structpages v0.6.0 semantic changes plus a lint↔runtime fix that's been outstanding since the analyzer landed.

What's new

Lint mirrors runtime for ID-context qualified Ref

The runtime's idForRef walks the whole page tree by Name when resolving a qualified Ref like Ref("EntryDetail.Overlays"). The lint analyzer was anchoring only at root or root.Children — so valid ID-context Refs whose anchor sits deeper in the tree errored at lint time even though the runtime accepted them. The asymmetry forced suppressions in cross-package slot-target code.

  • findRefAnchor switches behavior on isIDContext: whole-tree walk for ID, root + children for URL.
  • checkRefConversion only emits when both URL and ID contexts fail (a real typo). Per-context failures surface at the call site instead.
  • URLFor's call site no longer silently swallows Ref errors — it emits URL-context errors that the permissive conversion check intentionally lets through.

[]any chain form for ID / IDTarget

End-to-end validation of the new []any{Parent{}, Leaf{}, "Method"} and []any{Parent{}, Leaf{}.Method} shapes — mirroring the URLFor chain analyzer.

Install

go install github.com/jackielii/structpages/tools/lint/cmd/structpages-lint@v0.1.6

Full diff

tools/lint/v0.1.5...tools/lint/v0.1.6