cairn check

Failing the build when a tour breaks.

Running it

npx cairn check src

Point it at the directory containing your anchors, flows and components. It exits 0 when clean and 1 on any finding.

Reading the output

✗ cairn check failed

  • 1 anchor(s) are registered but never applied to an element  [anchors-applied]
      - questions.save  (breaks "create-questions")  src/walkthrough/flows.ts:35
      Spread {...anchor(...)} on the element, or remove the anchor and the step pointing at it.

Four things: which anchor, which tour it breaks, a clickable location, and what to do.

The rules

PropTypeDefaultDescription
anchors-appliederrorAn anchor is registered and referenced by a flow, but never applied to an element.
anchors-registerederrorA data-cairn attribute whose value is not in the registry — usually a typo or a leftover.
route-conflictserrorA route in both pauseRoutes and handoffRoutes, or a flow handing off to itself.

In CI

package.json
"scripts": { "lint": "eslint . && cairn check src" }
.github/workflows/ci.yml
- run: npx cairn check src

Roughly 0.2s across 2,000 files, so it belongs in the fast lane next to your linter rather than in a nightly job.

What it does not do

  • It never executes your code. It reads files as text, so it is safe to run on untrusted branches and needs no build step first.
  • It cannot see rendering. An element that exists in source but never renders passes — that is the browser audit’s job.
  • It ignores quoted code. Comments and string literals are stripped first, so a docs page showing a defineAnchors sample will not register phantom anchors.