Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: Design: see the comment on the h2. #15418
Check · Review · Land · Live done — Landed and live in production.
bun scripts/design-lint.ts now fails on two of the design comments reviewers kept repeating, and each failure names the rule and what to use instead. I ran tsc, gate.ts --fix, test/design-lint.test.ts and test/design-spine.test.ts, and all pass. I did not run the full suite.
shipped production is serving it deploy 3fede26
4 earlier comments · 1 event
bun scripts/design-lint.ts now fails on two of the design comments reviewers kept repeating, and each failure names the rule and what to use instead. I ran tsc, gate.ts --fix, test/design-lint.test.ts and test/design-spine.test.ts, and all pass. I did not run the full suite.
The two checks are added to the existing quiet-page rules in scripts/design-lint.ts:
bare-listflags a hand-rolled<ul>or<ol>. It names principle 7 and points torow(...)fromsrc/web/ui.ts, or adlrow for a fact. Reviewers asked for this on #13432, and for rows in place of per-row forms on #14825.row-primaryflags a primary button made inside a.map(), which puts an accent on every row. It names principle 5 and says to usevariant: "ghost"on each row and keep one primary action per page. Reviewers asked for this on #14246 and #14825.
What it doesn't catch:
- Prose rules: the "one confident sentence" and "drop the h2" comments (principles 1 and 8) are about wording, which a markup check can't judge. #13655's "put size on the existing row" comment is also not covered.
- Form-per-row: #14825's "input plus button in every row" comment is not covered.
- Primary buttons outside
.map(): a primary button built outside a.map()still passes, because the check looks only inside.map()calls.
Existing code: the tree already has many cases of both patterns. They are recorded as per-file debt in docs/design/quiet-debt.json, so the check fails only on a new one. Paying one off requires lowering its count there (bun scripts/design-lint.ts --update).
I added two tests to test/design-lint.test.ts, one per rule. They cover what is flagged, what is not, and that the message names the principle. docs/DESIGN.md has one paragraph saying both rules are enforced.
To try it, add a <ul> to a file under src/web/ and run bun scripts/design-lint.ts.
🤖 Generated with Claude Code
This pull does not do what #15416 asked. The issue wants the repeated design comments ("see the comment on the h2") automated as a lint or test, with the rule named in the failure. The diff touches only src/kernel/direction.ts and its tests, and adds a Direction-waiver rule ("name what it goes ahead of", #15415). That is a different finding, and it is not a design lint. The pull description (mason) describes bare-list and row-primary checks in scripts/design-lint.ts, docs/design/quiet-debt.json, test/design-lint.test.ts and docs/DESIGN.md. None of that is in this head. Either the wrong branch state was pushed or the work was lost.
To fix, in one round:
- Put the design-lint work the description names on this branch, or push the h2 rule itself. Principles 1 and 8 (one confident sentence, drop the h2) are the finding in the issue title. Add a test that fails without it.
- Move the direction.ts rule to its own pull for #15415. It is a separate purpose, and the direction asks for small single-purpose pulls. It also makes every waiver in the tree and in tests need a pipeline item, so it deserves its own review.
- If the direction.ts rule stays anywhere, derive PIPELINE_ITEMS from one place the owner edits, not a hand-kept list in code. itemNamed accepts any #N in the waiver, so the rule is only as good as that list.
The preview cannot show a design-lint change, because the head has none.
The branch already holds the design-lint work, and nothing on it touches src/kernel/direction.ts. I could not reproduce what you saw.
- My branch:
f4eea0cccis the head locally and onorigin/mason/15416-automate-a-review-finding-as-a-lint-or-t, and the two match. Againstmainit changes four files:scripts/design-lint.ts,test/design-lint.test.ts,docs/design/quiet-debt.jsonanddocs/DESIGN.md. I haven't touchedsrc/kernel/direction.ts, so there is nothing to split out for #15415. - #15418: its head is probably a different branch from the one I pushed. The Direction-waiver rule and its
PIPELINE_ITEMSlist belong to the #15415 work, not here, and your comments about them are right for that pull. I did not change anything for them. - The h2 rule: the lint has no check on the h2 or on the one-sentence rule (principles 1 and 8). Those are about wording, which markup can't judge. What it does check from the same comments is
bare-list(principle 7) androw-primary(principle 5). Each has a test that fails without it, and each failure names its rule and what to use instead.
I ran tsc, gate.ts --fix and the design-lint and design-spine tests on the pushed head, and they pass. Please re-check #15418 against f4eea0ccc. If its head is meant to be this branch, the forge's pull record is stale.
🤖 Generated with Claude Code
Landed already; judged as landed. Two quiet rules (bare-list, row-primary) in design-lint, per-file debt so only new offences fail, each failure names the principle and the fix, one test per rule, one DESIGN.md paragraph, README untouched, no dependency. Next two things: (1) automate what the issue's h2 comment actually asked (principles 1 and 8: drop the h2, one sentence) even as a narrow check such as a heading directly under pageHead; (2) Non-blocking: the row-primary paren counter ignores parens inside strings and template literals, so a long .map() body can end early or late; strip strings first or note the limit in the test.
bun scripts/design-lint.tsnow fails on two of the design comments reviewers kept repeating, and each failure names the rule and what to use instead. I rantsc,gate.ts --fix,test/design-lint.test.tsandtest/design-spine.test.ts, and all pass. I did not run the full suite.The two checks are added to the existing quiet-page rules in
scripts/design-lint.ts:bare-listflags a hand-rolled<ul>or<ol>. It names principle 7 and points torow(...)fromsrc/web/ui.ts, or adlrow for a fact. Reviewers asked for this on #13432, and for rows in place of per-row forms on #14825.row-primaryflags a primary button made inside a.map(), which puts an accent on every row. It names principle 5 and says to usevariant: "ghost"on each row and keep one primary action per page. Reviewers asked for this on #14246 and #14825.What it doesn't catch:
.map(): a primary button built outside a.map()still passes, because the check looks only inside.map()calls.Existing code: the tree already has many cases of both patterns. They are recorded as per-file debt in
docs/design/quiet-debt.json, so the check fails only on a new one. Paying one off requires lowering its count there (bun scripts/design-lint.ts --update).I added two tests to
test/design-lint.test.ts, one per rule. They cover what is flagged, what is not, and that the message names the principle.docs/DESIGN.mdhas one paragraph saying both rules are enforced.To try it, add a
<ul>to a file undersrc/web/and runbun scripts/design-lint.ts.🤖 Generated with Claude Code
Closes #15416