-
Notifications
You must be signed in to change notification settings - Fork 6
chore: add commit lint + biome to husky #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for graypaper-reader ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughAdds Husky Git hooks for pre-commit and commit-msg, introduces Commitlint configuration, and updates package.json to install Husky and Commitlint via devDependencies with a prepare script. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant Git as Git
participant Husky as Husky Hooks
participant Biome as Biome
participant TSC as TypeScript
participant CL as Commitlint
Dev->>Git: git commit
Git->>Husky: Run pre-commit
Husky->>Biome: biome check --write --no-errors-on-unmatched
Biome-->>Husky: status
Husky->>Git: git update-index --again
Husky->>TSC: tsc --noEmit -p ./tsconfig.app.json
TSC-->>Husky: status
alt pre-commit fails
Husky-->>Git: non-zero exit
Git-->>Dev: Abort commit
else pre-commit passes
Git->>Husky: Run commit-msg
Husky->>CL: commitlint --edit $1
alt commitlint fails
Husky-->>Git: non-zero exit
Git-->>Dev: Abort commit
else commitlint passes
Husky-->>Git: success
Git-->>Dev: Commit created
end
end
note over Husky: New/modified control flow: pre-commit checks (Biome, TSC) and commit-msg linting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (3)
.husky/pre-commit (1)
2-4: Optional: speed up the hook for large repos
- Consider running
tsc --noEmit --pretty falseand enabling incremental builds in your tsconfig for faster checks.- If commits often touch only docs or non-TS files, guard the tsc step (e.g., skip when no TS/TSX changes staged).
package.json (2)
17-18: Husky prepare script looks good; consider avoiding duplicate preview aliasesAdding
"prepare": "husky"is correct. You now have both"preview"and"serve"doingvite preview. If both are intentional, all good; otherwise, consider keeping a single alias to reduce confusion.
42-43: Pin minimum Node version for Commitlint/Husky compatibility
@commitlint/*@^19andhusky@^9require modern Node. Specify engines to prevent cryptic failures on older environments and align local/CI toolchains.Add this to package.json (outside the shown hunk):
{ "engines": { "node": ">=18.18.0 || >=20.0.0" }, "packageManager": "npm@>=9 || pnpm@>=8 || yarn@>=3" }Ensure CI uses a compatible Node version (e.g., via setup-node) to avoid hook/commitlint failures.
Also applies to: 52-52
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
.husky/commit-msg(1 hunks).husky/pre-commit(1 hunks)commitlint.config.js(1 hunks)package.json(3 hunks)
🔇 Additional comments (3)
commitlint.config.js (1)
1-1: LGTM: ESM config aligns with "type": "module"Using
export defaultwithextends: ["@commitlint/config-conventional"]is correct for Commitlint v19 in an ESM project. No issues spotted.package.json (2)
42-43: Dev tooling additions LGTMAdding Commitlint CLI and conventional config is consistent with the new commit-msg hook.
52-52: Husky devDependency LGTM
husky@^9pairs correctly with the prepare script you added.
…t have files to process
No description provided.