Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/ai-streaming/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AIStreamingApp extends Widget {
this.addChild(this._toolCall);
this.addChild(this._streamingText);

setInterval(() => {
clearInterval(window.__interval); window.__interval = setInterval(() => {
this._streamingText.tick();
}, 50);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/showcase/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class ShowcaseApp extends Widget {
if (event.key === 'q' || (event.ctrl && event.key === 'c')) return false;

// Tab switching: 1-5
const num = parseInt(event.key);
const num = parseInt(event.key, 10);
if (num >= 1 && num <= 5) {
this.switchTab(num - 1);
return true;
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export class DevServer {

this._killChild();

await exitedPromise.catch(() => {});
await exitedPromise.catch( => console.error());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
npx biome check packages/dev-server/src/server.ts packages/ui/src/Form.ts

Repository: Karanjot786/TermUI

Length of output: 2385


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- server.ts context ---\n'
nl -ba packages/dev-server/src/server.ts | sed -n '370,390p'

printf '\n--- Form.ts context ---\n'
nl -ba packages/ui/src/Form.ts | sed -n '125,150p'

printf '\n--- syntax/statistic checks ---\n'
node - <<'JS'
const { readFileSync } = require('node:fs');
const { resolveConfigSync } = require('/root/.npm/_npx/79069e5e14faec0b/node_modules/@biomejs/biome');

const files = [
  'packages/dev-server/src/server.ts',
  'packages/ui/src/Form.ts',
];

for (const file of files) {
  const src = readFileSync(file, 'utf8');
  console.log(`FILE ${file}`);
  console.log(`contains catch(( =>`: /(catch)\s*\(\s*=>/.test(src));
  console.log(`contains Promise.all and .catch nearby:`);
  const lines = src.split('\n');
  for (let i = 0; i < lines.length; i++) {
    const line = lines[i];
    if (line.includes('Promise.all') || line.trim().startsWith('.catch')) {
      console.log(`${i + 1}: ${line}`);
    }
  }
  try {
    const _ = resolveConfigSync(__dirname, {});
    console.log('biome config: success');
  } catch (err) {
    console.log('biome config: ' + String(err.message || err));
  }
  try {
    // eslint is not available, so only use the parser package if present; otherwise print unavailable.
    const { parserOptions, parseSync } = resolveConfigSync(__dirname, {vcs: {enabled: false}});
    console.log(`parse ${file}: ${parseSync(file, src, {}).diagnostic?.message ?? 'ok'}`);
  } catch (err) {
    const msg = String(err && err.message || err);
    console.log(`parse ${file}: ${msg}`);
  }
}
JS

Repository: Karanjot786/TermUI

Length of output: 247


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- server.ts context ---'
nl -ba packages/dev-server/src/server.ts | sed -n '370,390p'

printf '%s\n' ''
printf '%s\n' '--- Form.ts context ---'
nl -ba packages/ui/src/Form.ts | sed -n '125,150p'

printf '%s\n' ''
printf '%s\n' '--- syntax/statistic checks ---'
node - <<'JS'
const { readFileSync } = require('node:fs');

const files = [
  'packages/dev-server/src/server.ts',
  'packages/ui/src/Form.ts',
];

for (const file of files) {
  const src = readFileSync(file, 'utf8');
  console.log(`FILE ${file}`);
  console.log(`contains malformed catch callback: ${/\b(catch)\s*\(\s*=>/.test(src)}`);
  console.log(`lines with Promise.all or .catch:`);
  const lines = src.split('\n');
  for (let i = 0; i < lines.length; i++) {
    const line = lines[i];
    if (line.includes('Promise.all') || line.trim().startsWith('.catch')) {
      console.log(`${i + 1}: ${line}`);
    }
  }
}
JS

Repository: Karanjot786/TermUI

Length of output: 222


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- server.ts context ---'
awk 'NR==370,NR==390 {printf "%6d\t%s\n", NR, $0}' packages/dev-server/src/server.ts

printf '%s\n' ''
printf '%s\n' '--- Form.ts context ---'
awk 'NR==125,NR==150 {printf "%6d\t%s\n", NR, $0}' packages/ui/src/Form.ts

Repository: Karanjot786/TermUI

Length of output: 2188


Fix the malformed Promise rejection handlers before merging.

These changes make the TypeScript files unparsable.

  • packages/dev-server/src/server.ts#L383: change catch( => console.error()) to catch((error) => console.error(error)) or equivalent.
  • packages/ui/src/Form.ts#L142: attach .catch((err) => console.error("Promise.all failed:", err)) to the Promise.all(...) expression it rejects, or move it into try/catch.
🧰 Tools
🪛 Biome (2.5.6)

[error] 383-383: Expected a parenthesis '(' but instead found '=>'.

(parse)

📍 Affects 2 files
  • packages/dev-server/src/server.ts#L383-L383 (this comment)
  • packages/ui/src/Form.ts#L141-L142
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dev-server/src/server.ts` at line 383, Fix the malformed rejection
handler in packages/dev-server/src/server.ts lines 383-383 by making the catch
callback accept the rejected error and log it. In packages/ui/src/Form.ts lines
141-142, attach a rejection handler to the Promise.all expression or handle it
with try/catch, logging the failure error. Update the relevant promise-handling
code in both sites so the TypeScript parses correctly.

Source: Linters/SAST tools


if (this._running && this._entryFile) {
this._spawnChild();
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ export class Form extends Widget {
}
}
}

.catch(err => console.error("Promise.all failed:", err));
Loading