Conformance triage of bench against stx-standards — the 12 rules, measured rather than estimated. Companion to #87, which carries the one finding big enough to need its own issue.
Scorecard
| # | Rule | bench | |
|---|---|---|---|
| 1 | No <!DOCTYPE>/<html>/<head>/<body> in pages or components | 1 | exemption, see below |
| 2 | No vanilla DOM code | 18 files / 15 call sites | #87 |
| 3 | Crosswind only, no vanilla CSS | 8 files with <style> | see below |
| 4 | StxLink for internal navigation | 1 (was 2) | effectively clean — 177 StxLink |
| 5 | useHead/useSeoMeta, no hand-written <title> | 0 | clean |
| 6 | @stacksjs/components before hand-rolling | not measured | needs a per-primitive audit |
| 7 | Cross-page state in a store | not measured | bench already routes data through resources/stores/ |
| 8 | Directives, not JS that builds markup | 5 | RichTextEditor, see below |
| 9 | Never hand-import an auto-imported symbol | 0 | clean |
| 10 | Annotate every parameter and return | not measured | nothing verifies it — see note |
| 11 | ≤2 script blocks; client/lang="ts" redundant | 66 + 4 + 1 | cosmetic |
| 12 | No unencoded user data in script blocks | not measured | needs review alongside the XSS work |
For scale, the standards' reference audit of bughq found 263 plain <a> against 27 StxLink. bench is 1 against 177, and already runs the strict guard bughq had never enabled. The gaps below are real but this is not a codebase that ignored the rules.
Rule 1 — one file, and it is deliberate
resources/views/500.stx is a full standalone document. That is correct: a 500 page must render when the app shell is the thing that broke, so it cannot depend on layouts or the router. It also accounts for one of the two rule-4 hits (<a class="btn" href="/">), for the same reason.
resources/components/Bench/ArticleView.stx:531 matched the grep but is <head> inside a prose comment — a false positive, not a violation.
Rule 4 — fixed in passing
The one real violation was resources/views/court-houses/[id].stx:77, a plain <a href="/court-houses"> written earlier in this same session. Now <StxLink to="…">. The remaining hit is 500.stx, which is the exemption above.
Rule 3 — the 8 <style> blocks are a documented deviation, not drift
A project memory records why: @push-ed styles do not survive SPA navigation (the router swaps only <main>, and @push hoists to <head>), so component CSS is deliberately placed in a plain <style> inside the component body. Worth re-testing against current stx before treating it as permanent, but it is a reasoned position rather than neglect.
Rule 8 — 5 hits, all one component
createElement is confined to the rich-text editor, which wraps ts-medium-editor. config/ui.ts already allowlists it with that justification: DOM building is inherent to the third-party editor and cannot be expressed as directives. Accurate, and not worth chasing.
Rule 11 — 66 files, cosmetic
<script client> where client is redundant (66), more than two script blocks (4), lang="ts" (1). None of this is broken; it is noise that makes the rule harder to enforce later. Low priority, mechanical, and a good candidate for a codemod rather than hand edits.
Not measured, and why
Rules 6, 7, 10 and 12 need judgement per call site rather than a grep, so counting them would have produced a number with no meaning. Rule 10 is worth flagging specifically: the standards point out that nothing verifies annotations — tsc --noEmit cannot see inside .stx files, so a wrong type in a script block is silent. Any claim of rule-10 conformance here would be unfalsifiable with current tooling.
Suggested order
- #87 — rule 2, the only finding with a correctness consequence
- Rule 11 cleanup, mechanically
- Rules 6/7/10/12 audits, when there is a reason to open those files anyway