Skip to content

chore(tooling): add pre-commit prettier hook and consolidate prettier devDependency#995

Merged
robingenz merged 2 commits into
mainfrom
fix/issue-994
May 25, 2026
Merged

chore(tooling): add pre-commit prettier hook and consolidate prettier devDependency#995
robingenz merged 2 commits into
mainfrom
fix/issue-994

Conversation

@robingenz
Copy link
Copy Markdown
Member

Summary

  • Add husky + lint-staged so 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.
  • 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.

prettier-plugin-java duplication 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 install runs cleanly and triggers prepare → husky wires up core.hooksPath=.husky/_
  • Per-package npm run prettier -- --check still resolves prettier (verified via packages/analytics)
  • End-to-end: staged a prettier-dirty .ts file, npx lint-staged ran prettier --write and re-staged the formatted result
  • Commit with no matching staged files short-circuits cleanly (lint-staged could not find any staged files matching configured tasks)

Closes #994

Copilot AI review requested due to automatic review settings May 25, 2026 09:37
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-staged and a pre-commit hook to auto-run prettier --write on staged source files.
  • Consolidated prettier@3.4.2 into the root package.json and removed per-package prettier devDependencies.
  • Updated package-lock.json to 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.

Comment thread package.json
Comment thread .husky/pre-commit Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 25, 2026

Open in StackBlitz

@capacitor-firebase/analytics

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/analytics@995

@capacitor-firebase/app

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/app@995

@capacitor-firebase/app-check

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/app-check@995

@capacitor-firebase/authentication

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/authentication@995

@capacitor-firebase/crashlytics

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/crashlytics@995

@capacitor-firebase/firestore

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/firestore@995

@capacitor-firebase/functions

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/functions@995

@capacitor-firebase/messaging

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/messaging@995

@capacitor-firebase/performance

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/performance@995

@capacitor-firebase/remote-config

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/remote-config@995

@capacitor-firebase/storage

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/storage@995

commit: a0d15a5

@robingenz robingenz merged commit 78d8da2 into main May 25, 2026
6 checks passed
@robingenz robingenz deleted the fix/issue-994 branch May 25, 2026 14:45
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.
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.

chore(tooling): add pre-commit prettier hook and consolidate prettier devDependency

2 participants