Concrete
Rulesfixtures

concrete/fixtures/reachable-from-bundle

A module reachable from template.ts imports a file the fixture list reaches, or the sample library.

A module reachable from template.ts imports a file the fixture list reaches, or the sample library.

Graded by the fixtures stage of concrete check, in the tree venue. A violation reports this id and the file it failed at — see every rule and concrete check.

Reason

Nothing the fixture list reaches ships in a published bundle. That is the guarantee that lets a fixture hold whatever a preview needs — sample photos, a whole demo listing, megabytes of media — with no risk of any of it shipping to a customer. The rule is structural: it reads the same import graph the build bundles from, starting at template.ts, and any edge from that graph into a file the fixture list reaches — the list, a content fixture, a property document or its media — or into the sample library is the crossing.

Fix

Take the import out of the shipped module. Anything a section needs at render time arrives through its bindings, not through a file it imports — move the value into a slot, a source: or a literal. A photo a section really ships is a file of its own, outside any property's folder.

Before and after

// This half imports dev data from shipped code, which is the violation.
// @noErrors
import { Section, section, Slot, text } from "@homepages/concrete";

import typical from "../../fixtures/starter-home.json";

export const Hero = section(
  { key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.headline} as="h1" />
      <p>{typical.notes}</p>
    </Section>
  ),
);
import { Section, section, Slot, text } from "@homepages/concrete";

export const Hero = section(
  {
    key: "hero",
    label: "Hero",
    slots: { headline: text.medium({ label: "Headline" }), kicker: text.short({ label: "Kicker" }) },
  },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.headline} as="h1" />
      <Slot.Text slot={slot.kicker} as="p" />
    </Section>
  ),
);

On this page