chore(tooling): add pre-commit prettier hook and consolidate prettier devDependency#334
Merged
Merged
Conversation
… devDependency
- 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.
There was a problem hiding this comment.
Pull request overview
This PR updates repository tooling to enforce consistent Prettier formatting at commit-time across the npm workspaces, while centralizing the Prettier dependency at the repo root and aligning CI with the expected Node.js version.
Changes:
- Add Husky + lint-staged and configure a pre-commit hook to auto-run Prettier on staged files.
- Consolidate
prettier@3.4.2into the rootpackage.json(removing per-package Prettier devDependencies). - Bump CI Node.js version from 20 to 24.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/translation/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| packages/subject-segmentation/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| packages/selfie-segmentation/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| packages/face-mesh-detection/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| packages/face-detection/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| packages/document-scanner/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| packages/barcode-scanning/package.json | Removes per-package prettier devDependency to rely on workspace-hoisted Prettier. |
| package.json | Adds Husky/lint-staged + root Prettier and configures prepare + lint-staged tasks. |
| package-lock.json | Updates lockfile for new devDeps and reflects workspace dependency graph changes. |
| .husky/pre-commit | Adds pre-commit hook invoking lint-staged. |
| .github/workflows/ci.yml | Updates CI Node.js version to 24. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@capacitor-mlkit/barcode-scanning
@capacitor-mlkit/document-scanner
@capacitor-mlkit/face-detection
@capacitor-mlkit/face-mesh-detection
@capacitor-mlkit/selfie-segmentation
@capacitor-mlkit/subject-segmentation
@capacitor-mlkit/translation
commit: |
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.NODE_VERSIONfrom 20 to 24 to match the release workflow.prettier-plugin-javaduplication is left alone (already consistent — hoisted at root and listed in each package).Mirrors capawesome-team/capacitor-firebase#995.
Test plan
npm installruns cleanly and triggersprepare→ husky wires upcore.hooksPath=.husky/_npm run prettierstill resolves prettier via workspace hoist (verified viapackages/barcode-scanning)lint-staged could not find any staged files matching configured tasks)