Merged
Conversation
Based on https://code.claude.com/docs/en/hooks-guide#auto-format-code-after-edits Opted to avoid the example's use of `npx` to avoid internet usage. The formatting fails silently if the `prettier` package is not installed.
This is now completed by Claude hooks.
The lint fix script also verifies lint rules. There is no need to run both scripts.
dcalhoun
commented
Feb 6, 2026
Comment on lines
-204
to
-205
| # Format JavaScript code | ||
| make format |
Member
Author
There was a problem hiding this comment.
Removed as redundant of new formatting hook.
Comment on lines
-210
to
-211
| # Verify linting passes | ||
| make lint-js |
Member
Author
There was a problem hiding this comment.
Removed as redundant of make lint-js-fix above.
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.
What?
Adds a
.claude/settings.jsonfile with a PostToolUse hook that automatically runs Prettier on files after Claude Code edits them. Also simplifies the CLAUDE.md pre-commit checklist since formatting is now handled automatically.Why?
The project's CLAUDE.md pre-commit checklist requires running
make format(Prettier) andmake lint-js-fix(ESLint) before every commit. Without automation, formatting drift can accumulate during a Claude Code session, leading to noisy diffs and extra manual steps. This hook ensures every file Claude edits is immediately formatted, keeping code consistent without manual intervention.How?
.claude/settings.json: Adds aPostToolUsehook that triggers after everyEditorWritetool call. The hook extracts the edited file path from the tool input viajqand runs./node_modules/.bin/prettier --writeon that single file. Based on Claude examples.CLAUDE.md: Removesmake formatandmake lint-jsfrom the pre-commit checklist since formatting is now automatic. Onlymake lint-js-fixremains (ESLint is too slow for per-edit hooks and can make semantic changes).Design decisions
./node_modules/.bin/prettier) instead ofnpx— avoids any risk of downloading packages from the internet.jqis missing ornode_modulesisn't installed, Prettier fails silently and Claude continues. Prettier also respects.prettierignore.Testing Instructions
Not important that we test these scripting changes, but here are some ideas:
ios/) — confirm Prettier skips it gracefully.make lint-jsto confirm no formatting regressions.