Skip to content

Add prettier commit hook#2199

Open
alexandrudanpop wants to merge 1 commit intomainfrom
dependabot/lint-hook
Open

Add prettier commit hook#2199
alexandrudanpop wants to merge 1 commit intomainfrom
dependabot/lint-hook

Conversation

@alexandrudanpop
Copy link
Copy Markdown
Contributor

Fixes OPS-4067

Copilot AI review requested due to automatic review settings April 6, 2026 14:42
@linear
Copy link
Copy Markdown

linear bot commented Apr 6, 2026

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

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 aims to enforce Prettier formatting on staged files at commit time by adding a Husky pre-commit hook wired to lint-staged (OPS-4067).

Changes:

  • Bump husky from 8.0.3 to 9.1.7.
  • Add a lint-staged configuration to run prettier --write on common file types.
  • Add a .husky/pre-commit hook that runs npx lint-staged --verbose.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
package.json Updates Husky dependency version.
package-lock.json Locks Husky v9 resolution/metadata (node engine, bin path).
.lintstagedrc.json Adds Prettier formatting command for staged files.
.husky/pre-commit Adds pre-commit hook to run lint-staged.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The hook sources .husky/_/husky.sh, but this PR doesn’t add the .husky/_ directory (it’s not present in the repo). As-is, the hook will fail with “No such file” and the commit will be blocked. Add the Husky support files under .husky/_ (e.g., husky.sh and its companion files) or update the hook to match the Husky v9-generated template used in this repo.

Suggested change
. "$(dirname -- "$0")/_/husky.sh"

Copilot uses AI. Check for mistakes.
"eslint-plugin-vitest": "0.5.4",
"generate-license-file": "4.1.0",
"husky": "8.0.3",
"husky": "9.1.7",
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Bumping to Husky v9 won’t actually enable the hook unless Husky is installed to Git’s hooksPath (usually via husky/husky install during install). This repo’s prepare script currently only copies .env, so developers/CI won’t get hooks automatically. Update prepare (or add an appropriate lifecycle script) to run Husky installation in addition to the existing .env setup.

Copilot uses AI. Check for mistakes.
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