Skip to content

refactor: remove dead code and unused imports#664

Open
kamilwronka wants to merge 1 commit intodevelopfrom
claude/cranky-hamilton
Open

refactor: remove dead code and unused imports#664
kamilwronka wants to merge 1 commit intodevelopfrom
claude/cranky-hamilton

Conversation

@kamilwronka
Copy link
Copy Markdown
Contributor

@kamilwronka kamilwronka commented Apr 5, 2026

Summary

  • Remove unused OtherMap import from apps/game-client/src/types/margonem/game.ts
  • Remove dead variables (timeDiff, hasSignificantDiff, remoteTimestamp, localTime) and unused refetch destructuring from apps/game-client/src/hooks/use-timer-settings-sync.tsx — all were only referenced in commented-out conflict dialog code
  • Prefix unused state setters (_setRemoteUpdatedAt, _setLocalUpdatedAt) with _ to signal intentional non-use
  • Remove unused generatePlayers import from packages/cli/src/commands/seed/seed.ts

Why these are safe

  • All changes are dead code removal or unused import cleanup — no behavioral changes
  • Pre-commit hooks passed (lint, format, 197 tests green)
  • The commented-out conflict dialog feature is preserved; only the unused variables that fed into it are removed

Test plan

  • Pre-commit lint passed
  • Pre-commit format passed
  • All 197 game-client tests pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Cleaned up unused code and imports across the codebase to improve maintainability.

- Remove unused `OtherMap` import from game.ts
- Remove dead `timeDiff`, `hasSignificantDiff`, `remoteTimestamp`, `localTime` variables
  and unused `refetch` destructuring in use-timer-settings-sync.tsx
  (all were only used in commented-out conflict dialog code)
- Prefix unused state setters with `_` to signal intentional non-use
- Remove unused `generatePlayers` import from seed.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

Three files were cleaned up by removing unused imports and renaming state setters. In use-timer-settings-sync.tsx, state setters were prefixed with underscores and unused destructuring was dropped. In game.ts and seed.ts, unused named imports were removed.

Changes

Cohort / File(s) Summary
Unused Import Removal
apps/game-client/src/types/margonem/game.ts, packages/cli/src/commands/seed/seed.ts
Removed unused named imports (OtherMap, generatePlayers) to reduce clutter.
State Setter Renaming & Cleanup
apps/game-client/src/hooks/use-timer-settings-sync.tsx
Prefixed unused state setters with underscores (_setRemoteUpdatedAt, _setLocalUpdatedAt), dropped unused refetch destructuring, and removed conflict-dialog computation logic.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Whiskers twitch with glee,
Unused imports we set free,
Underscores mark what won't be used,
Code so clean, no time is lost! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: remove dead code and unused imports' accurately summarizes the main changes across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/cranky-hamilton

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/game-client/src/hooks/use-timer-settings-sync.tsx (1)

97-124: Consider removing or documenting the broken commented code.

The commented conflict dialog code references variables that were removed (hasSignificantDiff on line 101, remoteTimestamp on line 103). If this feature might be re-enabled in the future, consider either:

  1. Adding a TODO comment listing the variables that need to be restored, or
  2. Removing the commented code entirely if the feature is permanently disabled

This would prevent confusion if someone attempts to uncomment and re-enable the conflict dialog.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/game-client/src/hooks/use-timer-settings-sync.tsx` around lines 97 -
124, The commented-out conflict dialog block in use-timer-settings-sync.tsx
references removed variables (hasSignificantDiff, remoteTimestamp,
localTimestamp) and related setters (setLocalSnapshot, _setRemoteUpdatedAt,
_setLocalUpdatedAt, setShowConflict, setIsInitialized); either delete the entire
commented block if the dialog is permanently disabled, or replace it with a
concise TODO that documents which variables and state-management pieces must be
restored (list hasSignificantDiff, remoteTimestamp, localTimestamp, and the
snapshot/setter functions) before re-enabling, so future developers know exactly
what to reintroduce.
apps/game-client/src/types/margonem/game.ts (1)

3-3: Use import type for type-only import.

OldOtherMap is only used in a type position (line 11), so it should be imported with import type to clarify that it's a type-only dependency.

As per coding guidelines: Use import type for type-only imports.

♻️ Proposed fix
-import { OldOtherMap } from "./others";
+import type { OldOtherMap } from "./others";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/game-client/src/types/margonem/game.ts` at line 3, OldOtherMap is only
used as a type, so change its import to a type-only import: replace the value
import of OldOtherMap with an import type for OldOtherMap (from the same
"./others" module) so the compiler/runtime knows it is erased at emit; update
the import line that currently reads importing OldOtherMap and make it an
"import type" form to reflect its usage in the type declaration that references
OldOtherMap.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/game-client/src/hooks/use-timer-settings-sync.tsx`:
- Around line 97-124: The commented-out conflict dialog block in
use-timer-settings-sync.tsx references removed variables (hasSignificantDiff,
remoteTimestamp, localTimestamp) and related setters (setLocalSnapshot,
_setRemoteUpdatedAt, _setLocalUpdatedAt, setShowConflict, setIsInitialized);
either delete the entire commented block if the dialog is permanently disabled,
or replace it with a concise TODO that documents which variables and
state-management pieces must be restored (list hasSignificantDiff,
remoteTimestamp, localTimestamp, and the snapshot/setter functions) before
re-enabling, so future developers know exactly what to reintroduce.

In `@apps/game-client/src/types/margonem/game.ts`:
- Line 3: OldOtherMap is only used as a type, so change its import to a
type-only import: replace the value import of OldOtherMap with an import type
for OldOtherMap (from the same "./others" module) so the compiler/runtime knows
it is erased at emit; update the import line that currently reads importing
OldOtherMap and make it an "import type" form to reflect its usage in the type
declaration that references OldOtherMap.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ff861fb-5303-4570-aacb-28d57da3ee61

📥 Commits

Reviewing files that changed from the base of the PR and between f4fada0 and 3b0ba11.

📒 Files selected for processing (3)
  • apps/game-client/src/hooks/use-timer-settings-sync.tsx
  • apps/game-client/src/types/margonem/game.ts
  • packages/cli/src/commands/seed/seed.ts
💤 Files with no reviewable changes (1)
  • packages/cli/src/commands/seed/seed.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant