Skip to content

Commit fefd3da

Browse files
committed
claude: document the JIT vs AOT template-expression trap
Jest runs templates in JIT and tolerates broken binding expressions that the AOT production build rejects (NG5002 / parse errors). I shipped a backslash-escaped apostrophe in a [title] binding which passed jest cleanly and broke stage_prod/Build Frontend. New section in frontend/.claude/CLAUDE.md: 'Pre-push check: AOT- compile Angular templates' showing the apostrophe gotcha and the local command to catch it before push.
1 parent e1f2ecf commit fefd3da

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

frontend/.claude/CLAUDE.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,35 @@ npm run lint:fix # ESLint with auto-fix
6969
npm run prettier # Prettier formatting
7070
```
7171

72+
### Pre-push check: AOT-compile Angular templates
73+
74+
Jest tests run in **JIT** mode and accept template binding expressions
75+
that the **AOT** production build rejects. The most common gotcha:
76+
backslash-escaped apostrophes inside binding strings.
77+
78+
```html
79+
<!-- ✗ AOT rejects this with NG5002 "Unterminated quote" -->
80+
<span [title]="'It\'s broken' + suffix"></span>
81+
82+
<!-- ✓ Either avoid the apostrophe... -->
83+
<span [title]="'It is fine ' + suffix"></span>
84+
85+
<!-- ✓ ...or build the string in TypeScript and bind a property -->
86+
<span [title]="hoverText"></span>
87+
```
88+
89+
Before pushing changes that touch Angular template expressions
90+
(`[attr]="..."`, `{{ }}` interpolations, structural directives),
91+
run a full production AOT build:
92+
93+
```bash
94+
cd frontend
95+
node ./node_modules/.bin/ng build --configuration production --no-progress
96+
```
97+
98+
Warnings are fine; **errors fail CI**. Jest passing isn't enough —
99+
template expressions are only fully validated at AOT.
100+
72101
### Visual Identity (the differentiators from upstream)
73102

74103
Ordpool's design has a few rules that look like style choices but are

0 commit comments

Comments
 (0)