Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

workbenchthis machine

bun x tsc --noEmit passes on main again: src/ui/metrics-panel.js esc() never returns undefined #171

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

smith/arm:smith/168-bun-x-tsc-noemit-passes-on-main-again-sr → main 1 commit fork

  • Merged. smith/168-bun-x-tsc-noemit-passes-on-main-again-sr was merged into main as f728f93.

Review

Sign in to review this change.
2 files changed +2 −1
Software/so101/src/ui/metrics-panel.js +1 −1
@@ -8,7 +8,7 @@
88 /** @type {Record<string, string>} */
99 const ENTITIES = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
1010 /** @param {unknown} v */
11 export const esc = (v) => String(v).replace(/[&<>"']/g, (c) => ENTITIES[c]);
11 export const esc = (v) => String(v).replace(/[&<>"']/g, (c) => ENTITIES[c] ?? c);
1212
1313 /**
1414 * @param {any} m the /metrics summary
Software/so101/src/ui/metrics-panel.test.ts +1
@@ -6,6 +6,7 @@ const counters = { jam: 1, block: 2, stall: 3, missing: 4, hot: 5, stream: 6, mo
66 describe("the Metrics panel's rendering", () => {
77 test("escapes everything it prints", () => {
88 expect(esc(`<img src=x onerror="a('b')">&`)).toBe("&lt;img src=x onerror=&quot;a(&#39;b&#39;)&quot;&gt;&amp;");
9 expect(esc(`<a href="x">&'`)).toBe("&lt;a href=&quot;x&quot;&gt;&amp;&#39;");
910 expect(summaryHtml([["<k>", "<script>"]])).toBe("<b>&lt;k&gt;</b><span>&lt;script&gt;</span>");
1011 expect(peaksHtml({ 9: { load: 12.4, temperature: 40 } }, { 9: "<b>x</b>" })).toContain("<td>&lt;b&gt;x&lt;/b&gt;</td><td>12 %</td><td>40 °C</td>");
1112 expect(peaksHtml({ 3: { load: 1, temperature: 30 } }, { 3: "elbow_flex" })).toContain("<td>elbow_flex</td>");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs