Skip to content

Add pre-commit hook to run lint on staged files#79

Merged
YunchuWang merged 3 commits intomainfrom
copilot/add-precommit-lint-hook
Jan 30, 2026
Merged

Add pre-commit hook to run lint on staged files#79
YunchuWang merged 3 commits intomainfrom
copilot/add-precommit-lint-hook

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Adds a platform-independent pre-commit hook that blocks commits with linting errors.

Changes

  • Husky setup: Added prepare script to auto-install Git hooks on npm install
  • Pre-commit hook: .husky/pre-commit runs npx lint-staged before each commit
  • lint-staged config: Only lints staged *.{js,jsx,ts,tsx} files for fast feedback

Usage

After npm install, the hook is automatically active. Commits with ESLint errors will be blocked:

$ git commit -m "my changes"
✖ eslint found some errors. Please fix them and try committing again.

Uses husky (already in devDependencies) which handles cross-platform execution via Git's bundled shell on Windows.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • node-precompiled-binaries.grpc.io
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/durabletask-js/durabletask-js/node_modules/.bin/node-pre-gyp install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

add precommit hook to run lint , if any linting errors, should not commit. the hook should be platform independent and work on different platforms( windows, mac, linux, etc)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: YunchuWang <12449837+YunchuWang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add precommit hook to run lint checks and prevent committing errors Add pre-commit hook to run lint on staged files Jan 30, 2026
Copilot AI requested a review from YunchuWang January 30, 2026 23:04
@YunchuWang YunchuWang marked this pull request as ready for review January 30, 2026 23:05
Copilot AI review requested due to automatic review settings January 30, 2026 23:05
Copy link

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

Adds a cross-platform Git pre-commit hook (via Husky) to lint staged JS/TS files and block commits when linting fails.

Changes:

  • Add a prepare script to install Husky hooks automatically after npm install
  • Add a .husky/pre-commit hook that runs lint-staged
  • Add lint-staged dependency and configure it to run ESLint on staged *.{js,jsx,ts,tsx} files

Reviewed changes

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

File Description
package.json Adds Husky prepare install, introduces lint-staged dependency and config to run ESLint on staged JS/TS files
.husky/pre-commit Adds a pre-commit hook that executes lint-staged before allowing commits

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

@YunchuWang YunchuWang merged commit b1e1d53 into main Jan 30, 2026
7 checks passed
@YunchuWang YunchuWang deleted the copilot/add-precommit-lint-hook branch January 30, 2026 23:22
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.

4 participants