From 167c36263376f7daa92267aece291059071457e6 Mon Sep 17 00:00:00 2001 From: Continue Agent Date: Tue, 21 Oct 2025 23:33:37 +0000 Subject: [PATCH] Remove unused imports and variables from codebase - Remove unused imports from __tests__/math.test.ts (multiply, factorial, average, findMax) - Remove unused imports from __tests__/todoApp.test.ts (Todo interface) - Remove unused variables from __tests__/todoApp.test.ts (todo2) - Remove unused imports and console.log from api/users.ts (fs import) - Remove unused imports from index.ts (isAdmin, subtract) - Remove all unused imports and variables from src/utils/messyCode.ts Generated with [Continue](https://continue.dev) Co-authored-by: bekah-hawrot-weigel Co-Authored-By: Continue --- __tests__/math.test.ts | 2 +- __tests__/todoApp.test.ts | 4 +-- api/users.ts | 6 ++--- index.ts | 4 +-- src/utils/messyCode.ts | 56 +++++++-------------------------------- 5 files changed, 17 insertions(+), 55 deletions(-) diff --git a/__tests__/math.test.ts b/__tests__/math.test.ts index 0a29e79..a430fa8 100644 --- a/__tests__/math.test.ts +++ b/__tests__/math.test.ts @@ -4,7 +4,7 @@ * Many functions are not tested, and edge cases are missing */ -import { add, subtract, multiply, divide, factorial, isPrime, average, findMax } from '../src/utils/math'; +import { add, subtract, divide, isPrime } from '../src/utils/math'; describe('Math Utilities', () => { // Basic tests for add function diff --git a/__tests__/todoApp.test.ts b/__tests__/todoApp.test.ts index 05a9322..803357f 100644 --- a/__tests__/todoApp.test.ts +++ b/__tests__/todoApp.test.ts @@ -4,7 +4,7 @@ * Users can add these via workflows */ -import { TodoApp, Todo } from '../src/bonus/todoApp'; +import { TodoApp } from '../src/bonus/todoApp'; describe('TodoApp', () => { let app: TodoApp; @@ -109,7 +109,7 @@ describe('TodoApp', () => { describe('getCompletedTodos', () => { it('should return only completed todos', () => { const todo1 = app.addTodo('Todo 1'); - const todo2 = app.addTodo('Todo 2'); + app.addTodo('Todo 2'); const todo3 = app.addTodo('Todo 3'); app.completeTodo(todo1.id); diff --git a/api/users.ts b/api/users.ts index 45a29e0..85da6c7 100644 --- a/api/users.ts +++ b/api/users.ts @@ -48,11 +48,9 @@ export function isAdmin(userId: number): boolean { return user.role === 'admin'; } -// Unused import that should be cleaned up (for Workflow #2) -import * as fs from 'fs'; -// Console.log that should be removed (for Workflow #2) -console.log('Users API loaded'); + + /** * Format user display name diff --git a/index.ts b/index.ts index c4880cd..dc03b37 100644 --- a/index.ts +++ b/index.ts @@ -3,8 +3,8 @@ * This file demonstrates how the various modules work together */ -import { getUserById, getUserEmail, isAdmin } from './api/users'; -import { add, subtract, multiply, divide } from './src/utils/math'; +import { getUserById, getUserEmail } from './api/users'; +import { add, multiply, divide } from './src/utils/math'; import { createLogger } from './src/helpers/logger'; import { TodoApp } from './src/bonus/todoApp'; diff --git a/src/utils/messyCode.ts b/src/utils/messyCode.ts index 40f6a16..de59791 100644 --- a/src/utils/messyCode.ts +++ b/src/utils/messyCode.ts @@ -3,14 +3,9 @@ * Used for demonstrating Workflow #2 - Code Cleanup */ -// Unused imports that should be removed -import * as path from 'path'; -import { readFile } from 'fs'; -import * as crypto from 'crypto'; -// Inconsistent quotes -const message1 = "This uses double quotes"; -const message2 = 'This uses single quotes'; + + // Console.logs that should be removed console.log("Debug: Starting application"); @@ -21,10 +16,7 @@ function calculateSum (a:number,b:number):number{ return a+b; } -// Missing semicolons -const value1 = 42 -const value2 = "test" -let value3 = true + // Inconsistent indentation function processData(data: any) { @@ -38,54 +30,26 @@ if (data) { } } -// var instead of let/const -var oldStyleVariable = "should use const"; -var anotherVar = 123; -// Unused variables -const unusedVariable = "I'm never used"; -const anotherUnused = { key: "value" }; -// Inconsistent object spacing -const obj1 = {key1:"value1",key2:"value2"}; -const obj2 = { key1: "value1" , key2 : "value2" }; -// Inconsistent array spacing -const arr1 = [1,2,3,4,5]; -const arr2 = [ 1 , 2 , 3 , 4 , 5 ]; + + + + // Functions with any type function processAny(input: any): any { return input; } -// Template literals not used where they should be -const name = "User"; -const greeting = "Hello, " + name + "!"; -// Arrow function inconsistency -const arrow1 = (x) => x * 2; -const arrow2 = x=> { return x * 2 }; -// Trailing commas inconsistency -const config = { - option1: true, - option2: false, - option3: "maybe", // Has trailing comma -} -const config2 = { - option1: true, - option2: false, - option3: "maybe" // No trailing comma -} -// Mixed async patterns (could be improved) -function fetchDataCallback(callback: Function) { - setTimeout(() => { - callback("data"); - }, 1000); -} + + + // More console.logs to clean up console.warn("This is a warning");