fix: resolve 4 bugs in termui - #3604
Conversation
📝 WalkthroughWalkthroughThe change specifies radix 10 for tab parsing, adds ChangesBug fixes
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.6)packages/dev-server/src/server.tsFile contains syntax errors that prevent linting: Line 383: Expected a parenthesis '(' but instead found '=>'. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@packages/dev-server/src/server.ts`:
- Line 383: Fix the invalid rejection callback in the exitedPromise handling by
adding a parameter to the arrow function passed to catch and forwarding that
rejection value to console.error. Preserve the existing await and error-handling
flow.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: d59cf741-f5f2-48fd-91ac-143fbfc0b77f
📒 Files selected for processing (3)
examples/showcase/src/index.tsxpackages/dev-server/src/devtools.tspackages/dev-server/src/server.ts
| this._killChild(); | ||
|
|
||
| await exitedPromise.catch(() => {}); | ||
| await exitedPromise.catch( => console.error()); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
npx biome check packages/dev-server/src/server.tsRepository: Karanjot786/TermUI
Length of output: 2385
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "== Locate and inspect the reported line =="
wc -l packages/dev-server/src/server.ts
sed -n '360,395p' packages/dev-server/src/server.ts
echo "== Check whether the callback uses a valid parameter == "
python3 - <<'PY'
from pathlib import Path
import re
p = Path("packages/dev-server/src/server.ts")
text = p.read_text()
m = re.search(r"await\s+exitedPromise\.catch\s*\(\s*=>\s+console\.error\s*\(\)\s*\)\s*;", text)
print("arrow-catch-no-parameter-match=", bool(m))
if m:
print(m.group(0))
PY
echo "== Type-check with the repo toolchain if available (read-only) =="
if command -v npx >/dev/null 2>&1; then
npx tsc --noEmit --skipLibCheck packages/dev-server/src/server.ts || true
fiRepository: Karanjot786/TermUI
Length of output: 2039
Fix the invalid catch callback syntax.
await exitedPromise.catch( => console.error()); is invalid TypeScript because the arrow callback has no parameters. This prevents the dev server from compiling. Pass the rejection value to console.error.
Proposed fix
- await exitedPromise.catch( => console.error());
+ await exitedPromise.catch((error) => console.error(error));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| await exitedPromise.catch( => console.error()); | |
| await exitedPromise.catch((error) => console.error(error)); |
🧰 Tools
🪛 Biome (2.5.6)
[error] 383-383: Expected a parenthesis '(' but instead found '=>'.
(parse)
🤖 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 invalid rejection
callback in the exitedPromise handling by adding a parameter to the arrow
function passed to catch and forwarding that rejection value to console.error.
Preserve the existing await and error-handling flow.
Source: Linters/SAST tools
Description
This PR fixes real bugs found in the codebase:
parseInt: without10, strings like'0x1F'or'08'parse in unintended bases.trim()to''misses whitespace-only input;.trim().length === 0is explicit.Number.EPSILONtoMath.round: prevents floating-point drift (e.g.1.005 * 100rounding to 100 instead of 101).Type of Change
How Has This Been Tested?
Checklist
Summary by CodeRabbit