husky and lint-staged#477
Conversation
|
@Jumongweb is attempting to deploy a commit to the ritik4ever's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Jumongweb Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Warning Review limit reached
More reviews will be available in 56 minutes and 40 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR establishes automated code quality infrastructure by adding ESLint and Prettier configuration, integrating Husky with lint-staged to enforce linting on staged changes, and expanding developer documentation with setup instructions and pre-commit behavior guidance. ChangesPre-commit linting and code quality infrastructure
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.husky/pre-commit:
- Line 1: Add a shebang as the very first line of the pre-commit script so the
shell is explicit (e.g. use /usr/bin/env bash), keeping the existing npx
lint-staged invocation intact; ensure the pre-commit script remains executable
(chmod +x) after the change so Husky and other environments run it reliably.
In `@package.json`:
- Around line 27-29: Update package.json dependencies: change the "lint-staged"
version from "^16.4.0" to "^17.0.5" so the project can pick up the latest 17.x
release; while here double-check that "globals" ("globals": "^17.6.0") and
"husky" ("husky": "^9.1.7") are intentionally set to those stable versions and
update them only if you want newer releases—modify the version strings for
"lint-staged", "globals", or "husky" in package.json accordingly and run
npm/yarn install to verify no breakages.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a849c172-d460-49b0-9cf1-c708feb2d781
⛔ Files ignored due to path filters (2)
package-lock.jsonis excluded by!**/package-lock.jsonyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
.husky/pre-commit.prettierrcCONTRIBUTING.mdeslint.config.mjspackage.json
| @@ -0,0 +1 @@ | |||
| npx lint-staged | |||
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Add a shebang line for better portability.
The pre-commit hook script is missing a shebang line. While Husky may handle this automatically in some cases, including an explicit shebang ensures the script executes correctly across different environments.
🔧 Proposed fix to add shebang
+#!/bin/sh
npx lint-staged📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| npx lint-staged | |
| #!/bin/sh | |
| npx lint-staged |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.husky/pre-commit at line 1, Add a shebang as the very first line of the
pre-commit script so the shell is explicit (e.g. use /usr/bin/env bash), keeping
the existing npx lint-staged invocation intact; ensure the pre-commit script
remains executable (chmod +x) after the change so Husky and other environments
run it reliably.
| "globals": "^17.6.0", | ||
| "husky": "^9.1.7", | ||
| "lint-staged": "^16.4.0", |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
What are the latest stable versions of globals, husky, and lint-staged npm packages as of May 2026?
💡 Result:
Latest stable versions as of 2026-05-26: 1) globals: 17.6.0 [1][2] 2) husky: 9.1.7 [3] 3) lint-staged: 17.0.5 [4][5] Notes: “Latest stable” here is taken as the latest published version shown on each package’s npm page / registry record (i.e., the top of version history). [1][3][5]
Citations:
- 1: https://www.npmjs.com/package/globals
- 2: https://github.com/sindresorhus/globals/releases/tag/v17.6.0
- 3: https://www.npmjs.com/package/husky
- 4: https://github.com/lint-staged/lint-staged
- 5: https://registry.npmjs.org/lint-staged
🏁 Script executed:
#!/bin/bash
set -euo pipefail
base="https://registry.npmjs.org"
for pkg_ver in \
"globals@17.6.0" \
"husky@9.1.7" \
"lint-staged@16.4.0"
do
pkg="${pkg_ver%@*}"
ver="${pkg_ver#*@}"
echo "== $pkg@$ver =="
# If the version exists, the registry returns JSON; otherwise 404.
curl -sS -o "/tmp/${pkg}_${ver}.json" -w "%{http_code}\n" \
"$base/$pkg/$ver" | tail -n 1
if [[ "$(cat "/tmp/${pkg}_${ver}.json" | head -c 1)" == "{" ]]; then
# Extract version field if present
node -e "const fs=require('fs'); const j=JSON.parse(fs.readFileSync('/tmp/${pkg}_${ver}.json','utf8')); console.log(j.version||'no version field')"
else
echo "No JSON returned"
fi
doneRepository: ritik4ever/stellar-stream
Length of output: 165
Update lint-staged and re-check the other two versions in package.json
globals@^17.6.0(17.6.0) andhusky@^9.1.7(9.1.7) resolve to published stable versions.lint-staged@^16.4.0(16.4.0) is valid, but the latest stable is17.0.5;^16.4.0will not pick up17.x, so bump to^17.0.5to stay current.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@package.json` around lines 27 - 29, Update package.json dependencies: change
the "lint-staged" version from "^16.4.0" to "^17.0.5" so the project can pick up
the latest 17.x release; while here double-check that "globals" ("globals":
"^17.6.0") and "husky" ("husky": "^9.1.7") are intentionally set to those stable
versions and update them only if you want newer releases—modify the version
strings for "lint-staged", "globals", or "husky" in package.json accordingly and
run npm/yarn install to verify no breakages.
Closes #421
Implemented the Husky + lint-staged pre-commit flow.
Changed:
Added prepare: "husky" and lint-staged config in package.json (line 14)
Added Husky hook at .husky/pre-commit (line 1)
Added ESLint flat config for .ts/.tsx in eslint.config.mjs (line 1)
Added Prettier config in .prettierrc (line 1)
Documented setup, hook behavior, and WSL2 workflow in CONTRIBUTING.md (line 14)
Updated package-lock.json and yarn.lock with the new dev tooling
Verified:
npm run prepare installed Husky hooks
.husky/_/pre-commit runs lint-staged successfully
npx lint-staged --allow-empty exits cleanly with no staged files
A staged .ts file with an unfixable ESLint error blocked the commit path as expected
Summary by CodeRabbit
Documentation
Chores