Skip to content

Conversation

@anncwb
Copy link
Collaborator

@anncwb anncwb commented May 3, 2025

Description

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Chores
    • Switched Git hook management from Husky and lint-staged to Lefthook, updating configuration files and dependencies accordingly.
    • Removed Husky and lint-staged scripts and configuration; added Lefthook configuration for pre-commit, post-merge, and commit message hooks.
    • Updated documentation to reflect the use of Lefthook for Git hooks and code linting/formatting.
    • Adjusted workspace and package settings to accommodate the new Git hook tool.
    • Added a new script for codemod catalog operations.

@anncwb anncwb requested review from a team, jinmao88, mynetfan and vince292007 as code owners May 3, 2025 11:37
@changeset-bot
Copy link

changeset-bot bot commented May 3, 2025

⚠️ No Changeset found

Latest commit: 13565c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 3, 2025

Walkthrough

This update transitions the project's Git hook management from Husky and lint-staged to Lefthook. It removes Husky-related hook scripts and lint-staged configuration, introduces a new Lefthook configuration file (lefthook.yml), and updates documentation and configuration files to reference Lefthook. The prepare script in package.json now uses Lefthook, and Husky and lint-staged are removed from dependencies in favor of Lefthook. Documentation is revised to describe Lefthook usage, configuration, and disabling methods. Additionally, related file nesting and dependency catalog entries are updated, and a codemod script is added.

Changes

Files/Paths Change Summary
.husky/commit-msg, .husky/post-merge, .husky/pre-commit Removed Husky Git hook scripts for commit message linting, post-merge dependency install, and pre-commit checks
.lintstagedrc.mjs Deleted lint-staged configuration file
lefthook.yml Added Lefthook configuration for pre-commit, post-merge, and commit-msg hooks
package.json Switched prepare script to Lefthook, removed Husky/lint-staged, added Lefthook and a new codemod script
pnpm-workspace.yaml Removed Husky, replaced lint-staged with Lefthook, reordered some dependencies
.npmrc Changed hoist pattern from "husky" to "lefthook"
.vscode/settings.json Added lefthook.yml to file nesting for ESLint config
scripts/vsh/src/check-dep/index.ts Removed @vben/lint-staged-config from ignored packages
docs/src/en/guide/essentials/development.md, docs/src/guide/essentials/development.md Updated prepare script example to use Lefthook instead of Husky
docs/src/en/guide/other/faq.md, docs/src/guide/other/faq.md Updated references to Git hook config location from Husky to Lefthook
docs/src/en/guide/project/standard.md, docs/src/guide/project/standard.md Rewrote documentation to recommend Lefthook over Husky/lint-staged, added config/disabling instructions

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Git
    participant Lefthook
    participant Tools

    Developer->>Git: git commit
    Git->>Lefthook: Trigger pre-commit hook
    Lefthook->>Tools: Run format/lint commands on staged files
    Lefthook->>Tools: Update VSCode workspace config (if applicable)
    Lefthook->>Developer: Pre-commit checks complete

    Developer->>Git: git merge / git pull
    Git->>Lefthook: Trigger post-merge hook
    Lefthook->>Tools: Run pnpm install

    Developer->>Git: git commit
    Git->>Lefthook: Trigger commit-msg hook
    Lefthook->>Tools: Run commitlint on message
Loading

Suggested reviewers

  • mynetfan
  • jinmao88

Poem

A hop, a skip, a Lefthook leap,
Goodbye to Husky, no need to weep!
Pre-commit checks now running fast,
With lint and format—code unsurpassed.
Docs refreshed, dependencies neat,
This bunny’s work is quite a feat!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@anncwb anncwb merged commit 5689ac6 into main May 3, 2025
14 checks passed
@anncwb anncwb deleted the feature/lefthook branch May 3, 2025 11:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (6)
docs/src/en/guide/essentials/development.md (1)

101-102: Ensure documentation matches actual package.json.
The updated prepare script now uses Lefthook. Please confirm that this aligns with the root package.json and consider adding a note about installing lefthook as a devDependency so users know where the binary comes from.

lefthook.yml (2)

1-43: Consider streamlining the config by removing the large commented example.
The extensive commented-out example usage (lines 1–43) could be relocated to your documentation to keep lefthook.yml concise and maintainable.


73-77: Validate commit message hook.
The commit-msg hook invokes Commitlint on the commit message file. Consider wrapping $1 in quotes (e.g., --edit "$1") for better cross-platform safety.

docs/src/en/guide/project/standard.md (1)

151-156: Clarify the introduction to Lefthook.
The phrasing around checking all code vs. staged files could be tightened for clarity. Consider rewording to explain that Lefthook targets only staged changes.

docs/src/guide/project/standard.md (2)

151-157: Refine the Lefthook introduction wording for clarity

The current phrasing (“有一个问题就是校验会校验全部代码,但是我们只想校验我们自己提交的代码”) could be more concise and idiomatic. For example:

- 有一个问题就是校验会校验全部代码,但是我们只想校验我们自己提交的代码,这个时候就可以使用 lefthook。
+ 默认的预提交校验会针对整个代码库,但我们通常只需校验已暂存的变更,此时可使用 Lefthook 只在提交前运行针对性校验。
🧰 Tools
🪛 LanguageTool

[uncategorized] ~155-~155: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:有效"地"解决
Context: ...我们只想校验我们自己提交的代码,这个时候就可以使用 lefthook。 最有效的解决方案就是将 Lint 校验放到本地,常见做法是使用 lefthook 在本地...

(wb4)


195-204: Remind to reinstall hooks after updating lefthook.yml

After editing the lefthook.yml configuration, users must re-run the hook installation for changes to take effect. Consider appending:

+ # 编辑完成后,重新安装 Git hooks
+ pnpm lefthook install
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 045bc4e and 13565c6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • .husky/commit-msg (0 hunks)
  • .husky/post-merge (0 hunks)
  • .husky/pre-commit (0 hunks)
  • .lintstagedrc.mjs (0 hunks)
  • .npmrc (1 hunks)
  • .vscode/settings.json (1 hunks)
  • docs/src/en/guide/essentials/development.md (1 hunks)
  • docs/src/en/guide/other/faq.md (1 hunks)
  • docs/src/en/guide/project/standard.md (2 hunks)
  • docs/src/guide/essentials/development.md (1 hunks)
  • docs/src/guide/other/faq.md (1 hunks)
  • docs/src/guide/project/standard.md (2 hunks)
  • lefthook.yml (1 hunks)
  • package.json (2 hunks)
  • pnpm-workspace.yaml (2 hunks)
  • scripts/vsh/src/check-dep/index.ts (0 hunks)
💤 Files with no reviewable changes (5)
  • scripts/vsh/src/check-dep/index.ts
  • .husky/post-merge
  • .husky/commit-msg
  • .husky/pre-commit
  • .lintstagedrc.mjs
🧰 Additional context used
🪛 LanguageTool
docs/src/guide/other/faq.md

[uncategorized] ~21-~21: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:新"地"依赖
Context: ...git pull代码都要执行pnpm install的习惯,因为经常会有新的依赖包加入,项目在lefthook.yml已经配置了自动执行pnpm in...

(wb4)

docs/src/en/guide/project/standard.md

[uncategorized] ~159-~159: Loose punctuation mark.
Context: ...s inside lefthook.yml: - pre-commit: Runs before commit, used for code forma...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~161-~161: Loose punctuation mark.
Context: ...tting and checking - code-workspace: Updates VSCode workspace configuration ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~169-~169: Loose punctuation mark.
Context: ...Formats other JSON files - post-merge: Runs after merge, used for automatic de...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~171-~171: Loose punctuation mark.
Context: ...c dependency installation - install: Runs pnpm install to install new depe...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~173-~173: Loose punctuation mark.
Context: ...install new dependencies - commit-msg: Runs during commit, used for checking c...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~208-~208: Loose punctuation mark.
Context: ...s,jsx,ts,tsx}' ``` Where: - parallel: Whether to execute tasks in parallel - ...

(UNLIKELY_OPENING_PUNCTUATION)

docs/src/guide/project/standard.md

[uncategorized] ~155-~155: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:有效"地"解决
Context: ...我们只想校验我们自己提交的代码,这个时候就可以使用 lefthook。 最有效的解决方案就是将 Lint 校验放到本地,常见做法是使用 lefthook 在本地...

(wb4)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: post-update (windows-latest)
🔇 Additional comments (21)
docs/src/guide/essentials/development.md (1)

101-102: Switch prepare script to Lefthook
The prepare lifecycle script now installs Lefthook hooks (unless in CI), replacing Husky per the migration.

.npmrc (1)

2-2: Hoist Lefthook package
Updating public-hoist-pattern[] to include lefthook ensures its binaries are properly hoisted by pnpm in the workspace.

.vscode/settings.json (1)

222-222: Include Lefthook config in file nesting
Adding lefthook.yml alongside ESLint, Prettier, and other configs enhances visibility of the Git hook config in VSCode explorer.

docs/src/guide/other/faq.md (1)

21-21: Correct hook config reference
The FAQ now points to lefthook.yml for the post-merge pnpm install hook instead of the old Husky path, aligning with the migration.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~21-~21: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:新"地"依赖
Context: ...git pull代码都要执行pnpm install的习惯,因为经常会有新的依赖包加入,项目在lefthook.yml已经配置了自动执行pnpm in...

(wb4)

pnpm-workspace.yaml (3)

66-66: Reorder @vueuse/motion entry
This is a cosmetic reordering in the dependency catalog; no functional change.


121-121: Relocate lodash.set entry
This change only shifts lodash.set within the list; it does not affect its version or functionality.


117-117:

✅ Verification successful

Add Lefthook to workspace catalog
Lefthook has been introduced as the Git hook manager dependency. Please verify that version ^1.11.12 is available and meets your requirements.


🏁 Script executed:

#!/bin/bash
# Verify that Lefthook version ^1.11.12 exists on npm
npm view lefthook version

Length of output: 35


Lefthook version ^1.11.12 confirmed available

  • Verified via npm view lefthook version1.11.12
    No further action required.
docs/src/en/guide/other/faq.md (1)

21-21: Documentation correctly references lefthook.yml.
The guidance has been updated to reference lefthook.yml instead of Husky hooks. This aligns with the migration.

package.json (3)

54-54: Verify prepare script environment.
Ensure that lefthook is installed and resolvable when running prepare (is-ci || lefthook install) so CI and local environments install hooks correctly.


61-62: New version and catalog scripts added.
Introducing the version hook to update the lockfile and the catalog script for codemod operations is a clear enhancement for release and dependency management.


86-86: Add lefthook as a devDependency.
Including lefthook here ensures the CLI is available for hook installation and execution.

lefthook.yml (2)

44-67: Pre-commit hook configuration is well-structured.
The pre-commit section defines parallelized formatting and linting commands with appropriate glob patterns and caching, aligning with project standards.


68-72: Ensure post-merge dependency installation.
The post-merge hook runs pnpm install to keep dependencies in sync after merges, correctly replacing the previous Husky behavior.

docs/src/en/guide/project/standard.md (6)

37-37: Add Lefthook to the tool list.
Including Lefthook here correctly reflects the migration and informs contributors of the Git hook manager in use.


157-168: Pre-commit hook overview is accurate.
The list of jobs and their purposes under pre-commit matches the configuration in lefthook.yml.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~159-~159: Loose punctuation mark.
Context: ...s inside lefthook.yml: - pre-commit: Runs before commit, used for code forma...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~161-~161: Loose punctuation mark.
Context: ...tting and checking - code-workspace: Updates VSCode workspace configuration ...

(UNLIKELY_OPENING_PUNCTUATION)


169-172: Post-merge hook description is correct.
Replacing Husky’s post-merge with Lefthook’s post-merge aligns the docs with the new setup.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~169-~169: Loose punctuation mark.
Context: ...Formats other JSON files - post-merge: Runs after merge, used for automatic de...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~171-~171: Loose punctuation mark.
Context: ...c dependency installation - install: Runs pnpm install to install new depe...

(UNLIKELY_OPENING_PUNCTUATION)


173-175: Commit-msg hook documentation is up to date.
The commit-msg section now accurately describes Commitlint usage under Lefthook.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~173-~173: Loose punctuation mark.
Context: ...install new dependencies - commit-msg: Runs during commit, used for checking c...

(UNLIKELY_OPENING_PUNCTUATION)


179-189: Disable Lefthook instructions updated.
The temporary (--no-verify) and permanent (delete lefthook.yml) approaches are clear and correct.


195-205: Example Lefthook configuration snippet is helpful.
The YAML example illustrates key fields (parallel, jobs, run, glob, {staged_files}) effectively.

docs/src/guide/project/standard.md (2)

37-37: Include Lefthook in the list of integrated tools

The addition correctly enumerates Lefthook under the project’s linting tools, aligning with the PR’s migration objective and keeping the documentation up to date.


183-189: Disable Lefthook via --no-verify or by removing config

The updated instructions correctly reflect Lefthook’s disable mechanism, replacing the previous Husky steps. The temporary (--no-verify) and permanent (删除 lefthook.yml) disable commands are accurate and clear.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants