-
Notifications
You must be signed in to change notification settings - Fork 234
fix: resolve 4 bugs in termui #3573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,3 +138,5 @@ export class Form extends Widget { | |
| } | ||
| } | ||
| } | ||
|
|
||
| .catch(err => console.error("Promise.all failed:", err)); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,7 +182,7 @@ function _pathsEqual(a: number[], b: number[]): boolean { | |
|
|
||
| function _valuesEqual(a: string[], b: string[]): boolean { | ||
| if (a.length !== b.length) return false; | ||
| const sortedA = [...a].sort(); | ||
| const sortedA = [...a].sort((a, b) => a - b); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win Use one numeric comparator for both string arrays.
If tree values are decimal strings, parse both operands with radix 10 and reuse the comparator: Proposed fix function _valuesEqual(a: string[], b: string[]): boolean {
if (a.length !== b.length) return false;
- const sortedA = [...a].sort((a, b) => a - b);
- const sortedB = [...b].sort();
+ const compareNumeric = (left: string, right: string) =>
+ parseInt(left, 10) - parseInt(right, 10);
+ const sortedA = [...a].sort(compareNumeric);
+ const sortedB = [...b].sort(compareNumeric);As per coding guidelines, TypeScript files must use strict mode. #!/bin/bash
set -euo pipefail
config="$(fd -a -t f 'tsconfig.*\.json$' | head -n 1)"
test -n "$config"
npx tsc --noEmit --pretty false -p "$config"🤖 Prompt for AI Agents |
||
| const sortedB = [...b].sort(); | ||
| for (let i = 0; i < sortedA.length; i++) { | ||
| if (sortedA[i] !== sortedB[i]) return false; | ||
|
|
||
There was a problem hiding this comment.
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
Attach the rejection handler to
Promise.all.At Line 142,
.catch(...)starts a standalone statement. This causes the parse error reported by Biome and prevents the package from building.Wrap the
Promise.allcall at Line 83 intry/catch. When validation rejects, log the error, set_isValidatingtofalse, callmarkDirty(), and return or rethrow. Do not continue to iterate overresultsafter the aggregation fails.🧰 Tools
🪛 Biome (2.5.6)
[error] 142-142: Expected a statement but instead found '.catch(err => console.error("Promise.all failed:", err))'.
(parse)
🪛 GitHub Actions: CI / 0_build-and-test.txt
[error] 142-142: Build failed during tsup/esbuild and TypeScript declaration generation. Unexpected '.' at the start of '.catch(err => console.error("Promise.all failed:", err));', causing syntax errors including missing try, closing parenthesis, and semicolon. Command failed with exit code 1.
🪛 GitHub Actions: CI / build-and-test
[error] 142-142: Build failed during the tsup/esbuild build. Unexpected '.' at the standalone '.catch(err => console.error("Promise.all failed:", err));'. TypeScript also reports declaration/statement, ')' and ';' syntax errors, and cannot find name 'err'.
🤖 Prompt for AI Agents
Source: Linters/SAST tools