Skip to content

chore: no-array-index-key warnings (34) #1466

@steilerDev

Description

@steilerDev

Parent tracking issue: #1455

Summary

Resolve all 34 `@eslint-react/no-array-index-key` warnings. Using the array index as a React `key` causes mis-reconciliation when items are reordered, inserted, or removed — React reuses the wrong DOM nodes and component state.

Fix patterns (in priority order)

  1. Stable domain key — if items have an `id`, slug, or other unique field, use it.
  2. Composite stable key — combine domain fields (e.g., `${vendor}-${date}`) when no single field is unique.
  3. Generated stable key — for items that genuinely lack any natural key (rare), generate one at creation time:
    ```tsx
    const items = useMemo(
    () => rawItems.map((item) => ({ ...item, _key: crypto.randomUUID() })),
    [rawItems]
    );
    ```
    Note: the `useMemo` is critical — without it, you'd regenerate keys on every render and re-mount every child.

Scope

Production code (`client/src/`).

Acceptance Criteria

  • `npm run lint` reports 0 `@eslint-react/no-array-index-key` warnings
  • No regressions in list interactions (reorder, insert, delete) — verify with affected page's existing E2E tests where they exist
  • Component state (e.g., open/closed accordions, focused inputs) survives list reorders

Risk

Medium. Each fix is small, but mis-keyed lists can mask subtle state bugs. Verify lists that have any inline UI state (open menus, focused inputs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtTechnical debt cleanup work (lint, refactors, etc.)

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions