Enable Biome noArrayIndexKey rule and fix violations#795
Conversation
|
@cursor address cursor bugbot's comments, rebase onto the canary branch, address any merge conflicts, and then make sure that all the checks pass. |
|
Done. Here's what I did:
|
6e23de4 to
5548acb
Compare
|
@cursor please rebase onto Canary and resolve any conflicts. Fix any linter issues. |
5548acb to
d40dc43
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit d40dc43. Configure here.
|
@cursoragent Resolve the above bug bot issue |
|
Fixed the Bugbot issue. The problem was that |
|
@cursor please rebase onto Canary and resolve any conflicts. Fix any linter issues. |
- Enable noArrayIndexKey as 'error' in biome.jsonc (was 'off') - Use stable IDs where available: - footer.tsx: hotkey.key for hotkey list - help-dialog.tsx: opt.name for command options - shortcuts-dialog.tsx: keybinding.key for shortcuts list - web-wizard.tsx: host/port string values for scope lists - dialog-controls.tsx: control.key for control hints - Add biome-ignore suppressions for positional cell arrays that never reorder (animation frames, pixel grids, progress bars, display-only text lists) Co-authored-by: Jorge Alejandro Raad <jorge@pensar.dev>
…case Biome's formatter requires the multi-line format when the element exceeds the line width, and biome-ignore only suppresses when placed directly before the target attribute inside the element. Co-authored-by: Jorge Alejandro Raad <jorge@pensar.dev>
- pentest-workflow-display: key on t.target (natural URL identity) instead
of index over formatted strings. Iterate source targets directly.
- queued-messages: introduce QueuedMessage { id, text } type with monotonic
counter. Update queue.ts, queue.test.ts, queued-messages.tsx, and all
manipulation sites in operator-dashboard/index.tsx.
- agent-display: derive log key from toolCallId + array offset instead
of slice index.
Reduces biome-ignore suppressions from 16 to 13 — remaining 13 are all
positional animation/pixel cell arrays where index IS the stable identity.
Co-authored-by: Jorge Alejandro Raad <jorge@pensar.dev>
- agent-display.tsx: use Math.max(0, length - 3) to prevent negative offsets when fewer than 3 streaming logs exist - web-wizard.tsx: deduplicate at the add-handler level so host/port values are guaranteed unique, making value-based keys safe Co-authored-by: Jorge Alejandro Raad <jorge@pensar.dev>
Bugbot flagged that t.target alone can collide when multiple whitebox endpoints resolve to the same URL. Pre-compute a composite _key field (target + source index) in the useMemo so the render loop uses a guaranteed-unique key without triggering noArrayIndexKey. Co-authored-by: Jorge Alejandro Raad <jorge@pensar.dev>
39701d0 to
849d8dd
Compare




What does this PR do?
Enables the
noArrayIndexKeyBiome lint rule (previously"off", now"error") and resolves all 22 violations across the TUI codebase. Using array indices as Reactkeyprops causes stale renders when items reorder — this rule catches that pattern at lint time.Fixes using stable IDs (9 call sites):
footer.tsx—hotkey.key(e.g."Ctrl+C","?")help-dialog.tsx—opt.namefor command optionsshortcuts-dialog.tsx—keybinding.keyfor shortcut entriesweb-wizard.tsx— host/port string values for scope lists (with deduplication at the add-handler to guarantee uniqueness)dialog-controls.tsx—control.keyfor keyboard hint entriespentest-workflow-display.tsx—t.target(URL) from source data, iterating targets directly instead of pre-formatted stringsqueued-messages.tsx— introducedQueuedMessage { id, text }type with monotonic counter. Updatedqueue.ts,queue.test.ts,queued-messages.tsx, and all manipulation sites inoperator-dashboard/index.tsx.agent-display.tsx— derived key fromtoolCallId+ absolute array offset instead of slice indexSuppressed with
biome-ignore(13 call sites) — all positional animation/pixel cell arrays where the index IS the stable identity. These arrays are recomputed each frame, never reorder, and children are stateless:loaders.tsx— 9 animation cell arrays (BouncingBox, BracketBounce, WaveBar, BarPulse, OrbitDots, ScanLine, LaserBar, ShiningText)ascii-art.tsx— pixel grid (row y, column x)petri-animation.tsx— animation frame rowsfooter.tsx— progress bar cellsHow did you verify your code works?
bun run lint— passes with zero errorsbun run format:check— passes with zero errorsbun run tsc— type check passesbun run test— all 1029 tests pass, 15 skipped (integration tests)bun run build— build succeedscanary(resolvedbiome.jsoncconflict withnoImplicitAnyLet/noAssignInExpressionsrules)noArrayIndexKeyviolations remain: only 13biome-ignoresuppressions, all in animation/pixel cell components