Skip to content

SpaceView cleanup: fix no-case-declarations, deps, prefer-const #13

@sugan0tech

Description

@sugan0tech

Summary
Clean up SpaceView to satisfy lint rules and avoid subtle bugs from stale closures and switch-case scoping.

Context
src/components/game/SpaceView.tsx has:

  • no-case-declarations inside a switch.
  • Missing dependencies in useEffect/useCallback (e.g., lines ~480, ~515, ~560 warnings).
  • Unused refs/vars (usersRef, isMounted, offsetX/offsetY), and prefer-const hints.

Tasks

  • Wrap case blocks or extract logic to functions to satisfy no-case-declarations.
  • Fix hook dependency arrays by adding required deps or refactoring to stable callbacks/refs.
  • Remove unused refs/vars; switch let to const where not reassigned.
  • Smoke test interactions (rendering, input handling) to ensure parity.

Acceptance Criteria

  • npm run lint passes for SpaceView without warnings/errors listed above.
  • Manual sanity test shows movement/interaction still works as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions