Skip to content

Extract Magic Numbers to Named Constants #43

Description

@foxintheloop

Problem

Magic numbers are scattered across the codebase without explanation:

  • apps/electron/src/main/index.ts: 300ms debounce (line 146), 50ms changelog debounce (line 185)
  • apps/electron/src/main/ipc-handlers.ts: 366 max recurring occurrences (line 307)
  • apps/electron/src/renderer/App.tsx: 90min focus duration (line 25), 256/384px widths (lines 36/39)
  • apps/mcp-server/src/tools/schedule.ts: 6/22/15/30 hour/minute bounds (lines 10-13)
  • apps/mcp-server/src/index.ts: 30000ms tool timeout

Solution

Move all to named constants at module top or a shared config:

const DB_WATCHER_DEBOUNCE_MS = 300;
const CHANGELOG_DEBOUNCE_MS = 50;
const MAX_RECURRING_OCCURRENCES = 366;
const DEFAULT_FOCUS_DURATION_MIN = 90;

Files

  • Multiple files across electron and mcp-server apps

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions