Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Oct 10, 2025

Problem

make fmt and make fmt-check had different behaviors:

  • Different patterns (Makefile vs scripts/fmt.sh)
  • make fmt only ran Prettier, make fmt-check ran Prettier + Nix + shell
  • No single source of truth

Solution

Created fmt.mk that centralizes all formatting logic:

  • make fmtfmt-prettier + fmt-shell + fmt-nix
  • make fmt-checkfmt-prettier-check + fmt-shell-check + fmt-nix-check

Both use the same patterns and tools, guaranteed parity by construction.

Changes

  • Add fmt.mk: All formatting rules in one place
  • Update Makefile: Include fmt.mk, remove duplicate logic
  • Format shell scripts with shfmt
  • Always use bun x prettier for reproducibility

Generated with cmux

Problem:
- make fmt and make fmt-check had different behaviors
- Different patterns in Makefile vs scripts/fmt.sh
- make fmt only formatted Prettier files
- make fmt-check checked Prettier + Nix (but not shell)
- No single source of truth

Solution:
Created fmt.mk with centralized formatting logic that guarantees
parity between format and check commands.

Changes:
- Add fmt.mk: All formatting rules with single source of truth
- Update Makefile: Include fmt.mk, remove duplicate logic
- Format shell scripts: Apply shfmt formatting

Design:
- make fmt runs: fmt-prettier + fmt-shell + fmt-nix
- make fmt-check runs: fmt-prettier-check + fmt-shell-check + fmt-nix-check
- Same patterns, same tools, guaranteed parity

Benefits:
- Parity by construction (both use same underlying targets)
- Idiomatic Make (standard include mechanism)
- Composable (can run individual formatters)
- Maintainable (all logic in one place)
Uses the version specified in package.json rather than any globally
installed version.
@ammario ammario enabled auto-merge October 10, 2025 20:21
@ammario ammario added this pull request to the merge queue Oct 10, 2025
Merged via the queue into main with commit 0066cb0 Oct 10, 2025
7 checks passed
@ammario ammario deleted the fmt-parity branch October 10, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants