Files
babymonitor/SLOP_CLEANUP_PLAN.md
T

2.2 KiB

Frontend Systematic Audit & Cleanup Plan

Goal

Perform a comprehensive audit and cleanup of the frontend/ directory to remove shadowing, duplicates, corruption (appending), and dead code.

Phase 1: Discovery (READ-ONLY)

I will conduct a comprehensive scan of the frontend/ directory to build an accurate inventory.

  • File Shadowing Audit: Scan for files with overlapping names but different extensions (e.g., .js vs .ts, .jsx vs .tsx) that cause build-time shadowing.
  • Implementation Duplicate Audit: Use content searching to find identical or near-identical function/class definitions across different files.
  • Corruption Check: Scan files for duplicate symbol declarations (identifying where code was incorrectly appended rather than replaced).
  • Dependency/Import Audit: Cross-reference package.json with actual imports to identify unused packages and orphaned imports in code.
  • Slop Identification: Locate commented-out blocks, unused variables, and dead functions.

Phase 2: Categorization (PLANNING)

I will create a structured todo list (FRONTEND_CLEANUP_TODO.md) with the following categories:

  • [DELETE]: Conflicting or redundant files (e.g., client.js).
  • [REPAIR]: Corrupted files that must be completely overwritten to remove duplicates.
  • [CLEAN]: Files requiring removal of unused imports, variables, or dead code.
  • [REFACTOR]: Files requiring naming or pattern consistency fixes.

Phase 3: Systematic Execution (IMPLEMENTATION)

I will execute the cleanup in this order to maintain stability:

  1. File Purge: Remove all files in the [DELETE] category first to resolve shadowing.
  2. File Repair: Use full-file rewrites for files in the [REPAIR] category.
  3. Slop Removal: Systematic pass through files in the [CLEAN] category.
  4. Verification:
    • Run npm install to ensure dependency integrity.
    • Run all existing tests (npm test) and the reproduction test to confirm functionality.
    • Check for build errors/linting issues.

Notes

  • This plan will be updated and tracked via FRONTEND_CLEANUP_TODO.md.
  • No changes will be made until the Phase 2 Todo list is reviewed and approved.