Skip to content

refactor: remove deprecated Editor pattern and migrate to pure functions#615

Merged
marcuscastelo merged 28 commits into
rc/v0.11.0from
marcuscastelo/issue602
Jun 4, 2025
Merged

refactor: remove deprecated Editor pattern and migrate to pure functions#615
marcuscastelo merged 28 commits into
rc/v0.11.0from
marcuscastelo/issue602

Conversation

@marcuscastelo

Copy link
Copy Markdown
Owner
  • 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

- 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
Copilot AI review requested due to automatic review settings June 3, 2025 22:56
@marcuscastelo marcuscastelo self-assigned this Jun 3, 2025
@vercel

vercel Bot commented Jun 3, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marucs-diet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2025 3:49pm

This comment was marked as outdated.

@marcuscastelo
marcuscastelo requested a review from Copilot June 3, 2025 23:25

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/modules/diet/food/infrastructure/api/application/apiFood.ts
@marcuscastelo
marcuscastelo merged commit bb28575 into rc/v0.11.0 Jun 4, 2025
5 checks passed
@marcuscastelo
marcuscastelo deleted the marcuscastelo/issue602 branch June 4, 2025 15:57
@marcuscastelo marcuscastelo added the improvement Technical debt or general improvement label Jun 7, 2025
@marcuscastelo marcuscastelo modified the milestones: v0.13.0, v0.12.0 Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Technical debt or general improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove deprecated Editor pattern - Replace with pure functions (see CODESTYLE_GUIDE.md #3)

2 participants