Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 68f5f2c

Browse files
vitbokischclaude
andcommitted
Update templates and docs for camelCase JSX attributes
Fix onclick→onClick in template routes (counter, dashboard). Add JSX attribute casing rules to anti-patterns. Update template CLAUDE.md with srcSet/fetchPriority guidance. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4d32fcc commit 68f5f2c

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

.claude/rules/anti-patterns.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
- **Never** call `signal(value)` to set — use `signal.set(value)` or `signal.update(fn)`
1313
- **Never** forget to call signal as function to read: use `count()` not `count`
1414

15+
## JSX attribute casing
16+
- **Always** use camelCase for JSX attributes: `onClick`, `onMouseEnter`, `onTouchStart`, `onLoad`
17+
- **Never** use lowercase DOM event names: `onclick`, `onmouseenter`, `ontouchstart`, `onload`
18+
- **Always** use `srcSet` not `srcset`, `fetchPriority` not `fetchpriority`
19+
- **Always** use `className``class`, `htmlFor``for` (Pyreon uses HTML names, not React names)
20+
1521
## JSX reactive expressions
1622
- **Never** use bare signal reads in JSX text — wrap in arrow: `{() => count()}` not `{count()}`
1723
- **Never** return `undefined` from reactive JSX attributes — return empty string `''` instead

packages/create-zero/templates/default/CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ This project uses Pyreon Zero, a signal-based full-stack meta-framework. Do NOT
1515

1616
- Use `class=` not `className`
1717
- Use `for=` not `htmlFor`
18+
- Use camelCase events: `onClick`, `onMouseEnter`, `onLoad` (not `onclick`, `onmouseenter`)
19+
- Use `srcSet` not `srcset`, `fetchPriority` not `fetchpriority`
1820
- Reactive text: `{() => count()}`
1921
- Conditional: `{() => show() ? <A /> : null}`
2022
- Lists: `{() => items().map(item => <Item />)}`
21-
- Events: `onClick={() => ...}` (standard DOM events)
23+
- Events: `onClick={() => ...}`
2224
- JSX import source is `@pyreon/core` (auto-configured, no manual import needed)
2325

2426
## File-Based Routing

packages/create-zero/templates/default/src/routes/(admin)/dashboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default function Dashboard() {
110110
<button
111111
type="button"
112112
class="btn btn-secondary"
113-
onclick={() => {
113+
onClick={() => {
114114
localStorage.removeItem('zero-demo-auth')
115115
window.location.href = '/about'
116116
}}

packages/create-zero/templates/default/src/routes/counter.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ export default function Counter() {
3131
<button
3232
type="button"
3333
class="btn btn-secondary"
34-
onclick={() => count.update((n) => n - 1)}
34+
onClick={() => count.update((n) => n - 1)}
3535
>
3636
-
3737
</button>
3838
<button
3939
type="button"
4040
class="btn btn-primary"
41-
onclick={() => count.set(0)}
41+
onClick={() => count.set(0)}
4242
>
4343
Reset
4444
</button>
4545
<button
4646
type="button"
4747
class="btn btn-secondary"
48-
onclick={() => count.update((n) => n + 1)}
48+
onClick={() => count.update((n) => n + 1)}
4949
>
5050
+
5151
</button>

0 commit comments

Comments
 (0)