munch-ease-frontend/refactor-strategy.md
2025-10-18 14:12:27 +11:00

1.8 KiB

Refactor Strategy

This document outlines a pragmatic, step-by-step refactor plan to improve structure, readability, and maintainability. Each step includes a clear outcome and a checkbox to track progress.

Last updated: 2025-10-18

Goals

  • Separate concerns (routing, HTTP/API, mapping/normalization, UI logic)
  • Improve readability and testability
  • Establish light-weight standards (naming, lint/format) without blocking development
  • Keep changes incremental and safe

Phases and Steps

Phase 1 — Routing and Auth (Foundational)

Refactor Strategy (Outstanding Work)

Last updated: 2025-10-18

Only outstanding, actionable steps are listed below. Completed work has been removed for clarity.

1) Linting and rules modernization

  • Evaluate upgrading ESLint and eslint-plugin-vue to latest that fully supports Vue 3 macros and recommended rules.
  • Align rules with Composition API best practices; ensure Prettier remains source of truth.

Acceptance: ESLint upgrade plan decided (or implemented), rules apply cleanly, lint passes.

2) Alerts as a composable

  • DONE: Replaced the event bus with useAlert composable and updated AlertToast.vue and callers.
  • Follow-up: consider queuing multiple alerts if needed (current behavior shows latest only).

Acceptance: N/A (completed). Optional enhancement if queuing desired.

3) Incremental test coverage

  • Add unit tests for new utilities/composables when added (e.g., useAlert).
  • Consider snapshot tests for components with stable UI fragments (cards, list items).

Acceptance: New logic lands with tests; existing tests stay green.

4) Developer experience

  • Document .env usage with VUE_APP_API_BASE and add a .env.example file.
  • Add Volar as a recommended extension in the project docs (README updated).

Acceptance: Clear env setup; editor help consistent.