template-kit/fixtures-invalid
The template-kit/fixtures-invalid authoring rule — what it enforces, why, and how to fix it.
fixtures.tsis the one contract file nothing else parses for you. This is that parse.
The default export of fixtures.ts must satisfy the fixture-module shape:
{ base: { slots: { /* every required slot, with a valid value */ }, options: { /* optional */ }, anchors: { /* optional */ }, variants: { /* optional */ }, }, option_matrix: [ /* optional: { label?, options } entries */ ], states: { /* optional: named state → { label?, slots?, options?, anchors?, variants? } */ },}base is required and must be an object holding a slots record — every other key is
optional. Each violation names the exact path inside the module that’s wrong ("base",
"base.slots", "states.empty-address", …) and what shape was expected there instead.
Reason
Section titled “Reason”schema.ts and fill-spec.ts are both Zod-parsed on the way into every other check, so a
malformed one is caught immediately. fixtures.ts used to be the exception: nothing
touched it until the render stage read it directly, so a wrong shape there surfaced as a
raw crash mid-render, blamed on whatever line happened to dereference the missing field —
never on the fixture that was actually wrong.
This gate exists to move that failure to where the mistake was made, with a message about the fixture module instead of a stack trace from three files away.
Read the message’s path — it points at the exact key that’s wrong — and bring that key’s shape in line with what’s documented above.
Before
Section titled “Before”import type { FixtureModule } from "@homepages/template-kit";
const fixtures: FixtureModule = { base: { slots: { headline: "A mansard Victorian in the heart of Jamaica Plain" }, }, states: { "no-photo": { slots: { hero_image: null }, label: 12 }, // ^ label must be a string },};
export default fixtures;Section "hero": fixtures.ts — "states.no-photo.label": Expected string, received number.import type { FixtureModule } from "@homepages/template-kit";
const fixtures: FixtureModule = { base: { slots: { headline: "A mansard Victorian in the heart of Jamaica Plain" }, }, states: { "no-photo": { slots: { hero_image: null }, label: "No hero photo" }, },};
export default fixtures;See also
Section titled “See also”- The schema system —
fixtures.ts’s place among the section’s four contract files. schema-invalid— the sibling gate onschema.tsandfill-spec.ts.bundle-incomplete— reported instead of this id whenfixtures.tsis missing outright, rather than present and wrong.