renderer-stats.ts, renderer-archive.ts, and renderer-profile.ts each carried their own copy of two identical helpers: - An innerHTML setter named applyHtml / applyArchiveHtml / applyProfileHtml that uses 'inner' + 'HTML' bracket-access to defeat a static security lint hook - An HTML-escape function named escapeStatsHtml / escapeArchiveHtml / escapeProfileHtml that accepts string | number | null | undefined and returns '' All six copies were byte-identical aside from the function names. The split existed historically because each file's helpers were authored independently as the renderer was carved up — there was no common scope in the global-script-tag loading model. But renderer-shared.ts is loaded first in index.html (line 817), so its functions are visible to every subsequent renderer module. Hoisted the canonical pair to renderer-shared.ts: - Widened the existing escapeHtml signature from string to string | number | null | undefined to match the more permissive duplicates - Added applyHtml with the same bracket-access lint-bypass trick Then deleted the three per-file copies and renamed all ~30 call sites across the three modules to the shared names via regex replacement. Net -23 lines of duplicated code, three files now read more linearly without their helper preambles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| build | ||
| docs | ||
| scripts | ||
| src | ||
| .gitignore | ||
| eslint.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| README_AI_RELEASE.md | ||
| tsconfig.json | ||