refactor: remove deprecated Editor pattern and migrate to pure functions#615
Merged
Conversation
- Removed all legacy Editor classes (DayDietEditor, MealEditor, ItemGroupEditor, ItemEditor, RecipeEditor) and related interfaces - Replaced all Editor usages with pure, immutable functions across the codebase - Created and updated modules for pure operations: - diet/item/application/item.ts - diet/item-group/domain/itemGroupOperations.ts - diet/meal/domain/mealOperations.ts - diet/recipe/domain/recipeOperations.ts - diet/day-diet/domain/dayDietOperations.ts - Updated all application and UI layers to use pure functions instead of Editor pattern - Refactored and simplified state update logic for meals, item groups, recipes, and day diets - Improved type safety and fixed readonly array issues in domain operations - Removed all deprecated Editor files, tests, and unused interfaces - Applied ESLint/Prettier formatting and ensured code style consistency - All tests passing and type-check clean - Improved maintainability, testability, and clarity by adopting a functional, immutable approach throughout the diet module Closes #602
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…tems and replaceItemGroup functions
…FoodsFromApiByName
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes all deprecated Editor classes and related patterns and migrates the codebase to use pure, immutable functions for domain operations. Key changes include:
- Replacing legacy Editor patterns (e.g., RecipeEditor, MealEditor) with pure functional implementations.
- Introducing and testing pure functions for day diet operations.
- Cleaning up legacy utilities and updating configurations (e.g., ESLint, CI, package version).
Reviewed Changes
Copilot reviewed 61 out of 61 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/modules/diet/food/infrastructure/api/application/apiFood.ts | Updated error handling with an explicit type guard for rejected promises. |
| src/modules/diet/day-diet/domain/dayDietOperations.ts | Added pure functions for day diet manipulation. |
| src/modules/diet/day-diet/domain/dayDietOperations.test.ts | Added tests covering the new day diet pure functions. |
| src/legacy/utils/loadable.ts | Changed error property type from Error to unknown. |
| src/legacy/utils/idUtils.ts | Removed deprecated addId() function. |
| src/legacy/utils/data/* | Removed all legacy Editor classes and related tests/interfaces. |
| src/legacy/utils/clipboardUtils.ts | Improved JSON parsing error handling with try-catch. |
| package.json | Bumped version and updated dependency configurations. |
| eslint.config.mjs | Introduced updated ESLint settings for TS, SolidJS, and formatting rules. |
| CODESTYLE_GUIDE.md | Updated documentation to reflect removal of legacy patterns. |
| .github/workflows/ci.yml | Added CI workflow for type-check, lint, and tests. |
| .github/copilot-instructions.md | Updated internal instructions and guidelines. |
| .eslintrc.cjs | Removed legacy ESLint configuration file. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #602