diff --git a/code-removal-and-consolodation-spec.md b/code-removal-and-consolodation-spec.md index 1303f77..dd042b3 100644 --- a/code-removal-and-consolodation-spec.md +++ b/code-removal-and-consolodation-spec.md @@ -40,6 +40,12 @@ Status update (2025-10-21) - Resolved typecheck errors after domain ref opt-in changes: updated ShoppingListItem.vue to remove person ref usage and guard optional ingredient access; TS + vue-tsc + tests pass. - Verified end-to-end: lint PASS, typecheck PASS, vue-tsc PASS, tests PASS (no regressions). - Reduced nullability in public SDK APIs where safe: getRecipe/getMeal/markMealConsumed/getCurrentShoppingList now return non-null and throw on errors; updated call sites accordingly. + - Domain decoders now return non-null and throw on invalid input (decodeRecipe/decodeMeal/decodeMealRecipe/decodeIngredient/decodeShoppingListItem/decodeShoppingList); list decoders return arrays. + - Lint/typecheck/vue-tsc/tests: all PASS after decoder contract tightening. + +Latest analysis artifacts (2025-10-21) +- ts-prune (current): saved to ts-prune.current.txt; notable false-positives include dateformats.ago and units functions used inside SFCs. +- depcheck (current): saved to depcheck.current.json; flags core-js and several dev deps as unused. These are likely required by Vue CLI/babel/coverage tooling; defer removal pending deeper validation. Scope - In: TS/Vue app code, tests, configs, scripts; Python utilities if present. @@ -70,6 +76,7 @@ Ordered checklist (actionable) 2) Dead code inventory - [ ] ts-prune: list unused exports; verify via rg searches. + - [x] Refreshed ts-prune; review and mark SFC-used exports to avoid accidental removals. - [ ] Find unreferenced files: rg -l "export default|export const|export function" | while read f; do rg -q "(from|import).*$f" -g "!$f" . || echo "$f"; done @@ -138,6 +145,7 @@ Acceptance 8) Dependency cleanup - [ ] Remove unused npm deps (depcheck) and scripts. + - [x] Refreshed depcheck results saved; plan conservative removals only after confirming toolchain needs. - [ ] Prefer stdlib/small helpers over heavy libs where equal. - [ ] npm prune && clean install; verify build. @@ -189,6 +197,7 @@ Next actions (clear, actionable) 4) Shrink public API surface - [x] Use ts-prune results to remove unused exports in domain and sdk - [ ] Second pass: validate remaining ts-prune hints against .vue usage; prune safely + - [ ] Consider reducing parseRecipe nullability (throw on parse failures) if UI updated accordingly 5) Test suite consolidation - [x] De-duplicate tests with .js and .ts counterparts (e.g., prefer TypeScript) 6) Dependency cleanup diff --git a/depcheck.current.json b/depcheck.current.json new file mode 100644 index 0000000..99b311e --- /dev/null +++ b/depcheck.current.json @@ -0,0 +1 @@ +{"dependencies":["core-js"],"devDependencies":["@babel/core","@babel/eslint-parser","@vitest/coverage-v8","@vue/cli-plugin-eslint","@vue/cli-plugin-typescript","node-fetch","undici"],"missing":{"vue-eslint-parser":["/home/jables/source/doof/munch-ease-frontend/package.json"],"vite":["/home/jables/source/doof/munch-ease-frontend/tsconfig.json"]},"using":{"@vue/cli-plugin-babel":["/home/jables/source/doof/munch-ease-frontend/babel.config.js"],"@vue/cli-service":["/home/jables/source/doof/munch-ease-frontend/babel.config.js","/home/jables/source/doof/munch-ease-frontend/package.json","/home/jables/source/doof/munch-ease-frontend/vue.config.js"],"husky":["/home/jables/source/doof/munch-ease-frontend/package.json"],"openapi-typescript":["/home/jables/source/doof/munch-ease-frontend/package.json"],"prettier":["/home/jables/source/doof/munch-ease-frontend/package.json"],"typescript":["/home/jables/source/doof/munch-ease-frontend/package.json","/home/jables/source/doof/munch-ease-frontend/tests/test-setup.js","/home/jables/source/doof/munch-ease-frontend/src/main.ts","/home/jables/source/doof/munch-ease-frontend/src/shims-vue.d.ts","/home/jables/source/doof/munch-ease-frontend/src/composables/useAlert.ts","/home/jables/source/doof/munch-ease-frontend/src/composables/useAuth.ts","/home/jables/source/doof/munch-ease-frontend/src/composables/usePagination.ts","/home/jables/source/doof/munch-ease-frontend/src/components/AlertToast.vue","/home/jables/source/doof/munch-ease-frontend/src/components/LoginPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/CurrentShoppingListPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/MyShoppingPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/PurchasedShoppingListPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/ShoppingListItem.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/EditRecipePage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/RecipeSearchBox.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/DatePicker.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/EditMealPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/MealCard.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/MealPlanPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/PersonList.vue","/home/jables/source/doof/munch-ease-frontend/src/components/ingredients/CompactParsedIngredient.vue","/home/jables/source/doof/munch-ease-frontend/src/components/ingredients/EditableIngredientsPanel.vue","/home/jables/source/doof/munch-ease-frontend/src/components/ingredients/IngredientLine.vue"],"vitest":["/home/jables/source/doof/munch-ease-frontend/package.json","/home/jables/source/doof/munch-ease-frontend/vitest.config.js","/home/jables/source/doof/munch-ease-frontend/tests/mealMapper.test.js","/home/jables/source/doof/munch-ease-frontend/tests/meals.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/meals.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/parse.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/parse.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/persons.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/persons.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/recipes.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/recipes.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/shopping.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/shopping.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/shoppingListMapper.test.js","/home/jables/source/doof/munch-ease-frontend/tests/test-setup.js","/home/jables/source/doof/munch-ease-frontend/tests/units.test.js","/home/jables/source/doof/munch-ease-frontend/tests/useAlert.test.ts"],"vue-tsc":["/home/jables/source/doof/munch-ease-frontend/package.json"],"@types/node":["/home/jables/source/doof/munch-ease-frontend/package.json","/home/jables/source/doof/munch-ease-frontend/tsconfig.json","/home/jables/source/doof/munch-ease-frontend/vitest.config.js","/home/jables/source/doof/munch-ease-frontend/tests/mealMapper.test.js","/home/jables/source/doof/munch-ease-frontend/tests/meals.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/meals.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/parse.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/parse.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/persons.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/persons.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/recipes.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/recipes.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/shopping.api.errors.test.js","/home/jables/source/doof/munch-ease-frontend/tests/shopping.api.test.js","/home/jables/source/doof/munch-ease-frontend/tests/shoppingListMapper.test.js","/home/jables/source/doof/munch-ease-frontend/tests/test-setup.js","/home/jables/source/doof/munch-ease-frontend/tests/units.test.js","/home/jables/source/doof/munch-ease-frontend/tests/useAlert.test.ts"],"vue-eslint-parser":["/home/jables/source/doof/munch-ease-frontend/package.json"],"@typescript-eslint/eslint-plugin":["/home/jables/source/doof/munch-ease-frontend/package.json"],"eslint-plugin-vue":["/home/jables/source/doof/munch-ease-frontend/package.json"],"eslint":["/home/jables/source/doof/munch-ease-frontend/package.json"],"@typescript-eslint/parser":["/home/jables/source/doof/munch-ease-frontend/package.json"],"lint-staged":["/home/jables/source/doof/munch-ease-frontend/package.json"],"vite":["/home/jables/source/doof/munch-ease-frontend/tsconfig.json"],"msw":["/home/jables/source/doof/munch-ease-frontend/tests/test-setup.js"],"vue":["/home/jables/source/doof/munch-ease-frontend/src/main.ts","/home/jables/source/doof/munch-ease-frontend/src/shims-vue.d.ts","/home/jables/source/doof/munch-ease-frontend/src/router/helpers.ts","/home/jables/source/doof/munch-ease-frontend/src/router/index.ts","/home/jables/source/doof/munch-ease-frontend/src/composables/useAlert.ts","/home/jables/source/doof/munch-ease-frontend/src/composables/useAuth.ts","/home/jables/source/doof/munch-ease-frontend/src/composables/usePagination.ts","/home/jables/source/doof/munch-ease-frontend/src/components/AlertToast.vue","/home/jables/source/doof/munch-ease-frontend/src/components/LoginPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/CurrentShoppingListPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/MyShoppingPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/PurchasedShoppingListPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/ShoppingListItem.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/EditRecipePage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/RecipeSearchBox.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/RecipesPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/DatePicker.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/EditMealPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/MealCard.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/MealPlanPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/PersonList.vue","/home/jables/source/doof/munch-ease-frontend/src/components/ingredients/CompactParsedIngredient.vue","/home/jables/source/doof/munch-ease-frontend/src/components/ingredients/EditableIngredientsPanel.vue","/home/jables/source/doof/munch-ease-frontend/src/components/ingredients/IngredientLine.vue"],"vue-router":["/home/jables/source/doof/munch-ease-frontend/src/router/helpers.ts","/home/jables/source/doof/munch-ease-frontend/src/router/index.ts","/home/jables/source/doof/munch-ease-frontend/src/components/LoginPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/CurrentShoppingListPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/MyShoppingPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/shopping/PurchasedShoppingListPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/EditRecipePage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/recipes/RecipesPage.vue","/home/jables/source/doof/munch-ease-frontend/src/components/meals/EditMealPage.vue"],"openapi-fetch":["/home/jables/source/doof/munch-ease-frontend/src/api/client.ts"]},"invalidFiles":{},"invalidDirs":{}} diff --git a/ts-prune.current.txt b/ts-prune.current.txt new file mode 100644 index 0000000..74e2869 --- /dev/null +++ b/ts-prune.current.txt @@ -0,0 +1,54 @@ +src/dateformats.ts:6 - ago +src/units.ts:104 - getConversionFactor (used in module) +src/units.ts:130 - calculateTotals +src/units.ts:2 - UnitKey (used in module) +src/units.ts:4 - equivalentUnits (used in module) +src/units.ts:127 - Quantity (used in module) +src/units.ts:128 - Total (used in module) +src/api/sdk.ts:58 - mapPurchasedShoppingList (used in module) +src/api/sdk.ts:96 - mapCurrentShoppingList (used in module) +src/api/sdk.ts:140 - listRecipes +src/api/sdk.ts:153 - getRecipe +src/api/sdk.ts:161 - saveRecipe +src/api/sdk.ts:167 - deleteRecipe +src/api/sdk.ts:172 - parseRecipe +src/api/sdk.ts:178 - parseIngredients +src/api/sdk.ts:186 - parseProduct +src/api/sdk.ts:197 - listPersons (used in module) +src/api/sdk.ts:210 - getPersonsInHome +src/api/sdk.ts:214 - searchPersons +src/api/sdk.ts:219 - getUpcomingMeals +src/api/sdk.ts:231 - getMeal +src/api/sdk.ts:239 - saveMeal +src/api/sdk.ts:255 - markMealConsumed +src/api/sdk.ts:265 - deleteMeal +src/api/sdk.ts:303 - PurchaseExisting (used in module) +src/api/sdk.ts:304 - PurchaseRefs (used in module) +src/composables/useAlert.ts:27 - useAlert +src/composables/useAlert.ts:4 - AlertMessage (used in module) +src/composables/useAuth.ts:8 - loadUser (used in module) +src/composables/useAuth.ts:16 - login (used in module) +src/composables/useAuth.ts:21 - useAuth +src/composables/usePagination.ts:7 - usePagination +src/composables/usePagination.ts:4 - PageParams (used in module) +src/composables/usePagination.ts:5 - PageFetcher (used in module) +src/composables/useShopping.ts:8 - groupsToItems (used in module) +src/composables/useShopping.ts:12 - uniqueMeals (used in module) +src/composables/useShopping.ts:24 - itemsToGroups (used in module) +src/composables/useShopping.ts:54 - useShopping +src/composables/useShopping.ts:4 - GroupByProduct (used in module) +src/composables/useShopping.ts:5 - GroupByName (used in module) +src/composables/useShopping.ts:6 - Group (used in module) +src/domain/decoders.ts:54 - decodeMealRecipe (used in module) +src/domain/decoders.ts:73 - decodeShoppingListItem (used in module) +src/domain/decoders.ts:99 - toMealInput +src/domain/types.ts:4 - Replace (used in module) +src/domain/types.ts:5 - WithDates (used in module) +src/domain/types.ts:8 - Lookup (used in module) +src/domain/types.ts:10 - WithRefs (used in module) +src/domain/types.ts:18 - RecipeInput +src/domain/types.ts:20 - MealRecipeOut (used in module) +src/domain/types.ts:49 - ShoppingListWithRefs +src/router/helpers.ts:12 - parseRouteId +src/router/helpers.ts:24 - parseQueryString +src/router/index.ts:14 - createAppRouter