Last active
July 19, 2025 22:52
-
-
Save Colin7780/c035a9fbd9e6c75b9430c8ae9aa7c19e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 1. Identify and remove unused files and code | |
- Scan the project directory for files that are no longer referenced or used. | |
- Look for old backup files, temporary files, and deprecated modules. | |
- Remove entire files or code blocks that serve no purpose in the current application. | |
- Use the IDE's "Find Usages" feature to verify files aren't being imported elsewhere. | |
### 2. Remove unused imports, variables, and functions | |
- Clean up import statements at the top of files, removing any that aren't being used. | |
- Identify and remove variables, functions, types, and exports that are declared but never referenced. | |
- Use linting tools to automatically detect and remove unused elements. | |
### 3. Remove unnecessary console logs, dead code, legacy code, backwards compatibility code, and comments | |
- Delete `console.log` statements used for debugging, keeping only essential logging. | |
- Remove commented-out code blocks that are no longer needed. | |
- Clean up outdated comments that no longer reflect the code's behavior. | |
- Remove any experimental code that did not make it to production. | |
- Remove legacy and backwards compatibility code | |
### 4. Identify and refactor duplicate code | |
- Search for repeated code patterns across the codebase. | |
- Consolidate similar functions into a single, reusable function with parameters. | |
- Extract duplicate logic into shared utilities or helper methods. | |
- Apply the DRY (Don't Repeat Yourself) principle. | |
### 5. Simplify complex code and improve readability | |
- Refactor complex conditional logic (e.g., nested `if/else`) into simpler patterns like guard clauses or lookup maps. | |
- Break down large functions or classes into smaller, single-responsibility modules. | |
- Improve naming clarity by renaming poorly named variables, functions, and files to better reflect their purpose. | |
- Reduce complexity. | |
### 6. Address performance bottlenecks | |
- Use profiling tools to identify slow functions, memory leaks, or inefficient database queries. | |
- Optimize critical code paths that are frequently executed or have a major impact on user experience. | |
### 7. Run linters, formatters, and fix issues | |
- Execute the project's linting tools (e.g., ESLint) and fix all reported errors and warnings. | |
- Run code formatters (e.g., Prettier) to ensure a consistent style across the codebase. | |
- Run the type-checker (e.g., `npm run type-check`) and fix any type errors. | |
### 8. Submit the changes | |
- Stage and commit the changes with a clear and descriptive commit message. | |
- Create a pull request that documents the cleanup process and its results for team review. | |
Think extra hard. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment