concrete/slots/no-marker-literal
No code writes or reads a `data-slot-*` marker; the slot primitives emit them.
No code writes or reads a data-slot-* marker; the slot primitives emit them.
Graded by the lint stage of concrete check, in the lint venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
The data-slot-* attributes are the editor's wire format, and the slot primitives emit
every one of them from your section's slots. The marker contract
is exactly that: the primitive is the marker, and there is no second route identity can
arrive by. A hand-written attribute can spell anything — a slot that does not exist, a
shape the editor stopped emitting two versions ago — and nothing type-checks a string, so
the ban is syntactic, on writing one and on reading one back.
Fix
Render the slot through its primitive: Slot.Text, Slot.Image, Slot.Object, and the
rest. as picks the element, the remaining props are that element's own, and the marker
rides along on it.
Before and after
import { Section, section, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section>
<h1 data-slot-id="headline">{slot.headline.value}</h1>
</Section>
),
);import { Section, section, Slot, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section>
<Slot.Text slot={slot.headline} as="h1" />
</Section>
),
);