chore(tooling): add pre-commit prettier hook and consolidate prettier devDependency#995
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves contributor tooling in the capacitor-firebase monorepo by enforcing consistent Prettier formatting at commit time and centralizing the Prettier version at the workspace root to avoid version drift across packages/CI.
Changes:
- Added
husky+lint-stagedand a pre-commit hook to auto-runprettier --writeon staged source files. - Consolidated
prettier@3.4.2into the rootpackage.jsonand removed per-packageprettierdevDependencies. - Updated
package-lock.jsonto reflect the new root-level dependencies and hoisting.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds husky/lint-staged, configures prepare, and defines lint-staged tasks plus root prettier. |
| package-lock.json | Locks new tooling deps and updates the resolved Prettier installation. |
| .husky/pre-commit | Adds pre-commit hook to run lint-staged. |
| packages/analytics/package.json | Removes per-package prettier devDependency (relies on workspace root). |
| packages/app-check/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/app/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/authentication/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/crashlytics/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/firestore/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/functions/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/messaging/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/performance/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/remote-config/package.json | Removes per-package prettier devdependency (relies on workspace root). |
| packages/storage/package.json | Removes per-package prettier devdependency (relies on workspace root). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@capacitor-firebase/analytics
@capacitor-firebase/app
@capacitor-firebase/app-check
@capacitor-firebase/authentication
@capacitor-firebase/crashlytics
@capacitor-firebase/firestore
@capacitor-firebase/functions
@capacitor-firebase/messaging
@capacitor-firebase/performance
@capacitor-firebase/remote-config
@capacitor-firebase/storage
commit: |
robingenz
added a commit
to capawesome-team/capacitor-mlkit
that referenced
this pull request
May 25, 2026
… devDependency (#334) - Add husky + lint-staged so staged **/*.{css,html,ts,js,java} files are auto-formatted with the workspace-pinned prettier on every commit. - Move prettier@3.4.2 from every packages/*/package.json into the root package.json devDependencies (single source of truth). Per-package npm run prettier scripts continue to work via npm workspace hoisting. - Add "prepare": "husky" so npm install wires up the hook automatically. - Bump CI NODE_VERSION from 20 to 24 to match the release workflow. Mirrors capawesome-team/capacitor-firebase#995.
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.
Summary
husky+lint-stagedso staged**/*.{css,html,ts,js,java}files are auto-formatted with the workspace-pinned prettier on every commit. Makes it physically impossible to push prettier-dirty code without--no-verify.prettier@3.4.2from everypackages/*/package.jsoninto the rootpackage.jsondevDependencies (single source of truth). Per-packagenpm run prettierscripts continue to work via npm workspace hoisting."prepare": "husky"sonpm installwires up the hook automatically.prettier-plugin-javaduplication is left alone (already consistent — hoisted at root and listed in each package). Prettier version bump and ESLint in lint-staged are explicitly out of scope per the issue.Test plan
npm installruns cleanly and triggersprepare→ husky wires upcore.hooksPath=.husky/_npm run prettier -- --checkstill resolves prettier (verified viapackages/analytics).tsfile,npx lint-stagedranprettier --writeand re-staged the formatted resultlint-staged could not find any staged files matching configured tasks)Closes #994