Skip to content
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

chore: add husky and lint-staged #1062

Merged
merged 1 commit into from
Aug 31, 2024
Merged

chore: add husky and lint-staged #1062

merged 1 commit into from
Aug 31, 2024

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Aug 31, 2024

add husky and lint-staged

Summary by CodeRabbit

  • 新功能
    • 引入了预提交钩子配置,自动对待提交文件进行代码质量检查。
    • 添加了 lint-staged 配置,确保在提交前格式化所有文件。
  • 依赖更新
    • 更新了 package.json,添加了 huskylint-staged 依赖,以支持新的开发工作流。

Copy link

vercel bot commented Aug 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
select ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 31, 2024 3:02pm

Copy link
Contributor

coderabbitai bot commented Aug 31, 2024

Walkthrough

此次更改引入了新的 Git 钩子配置和依赖项,主要涉及在提交之前对暂存文件进行 lint 检查。新增的 .husky/pre-commit 文件配置了 npx lint-staged 命令,以确保在提交代码时自动检查代码质量。此外,package.json 文件中的脚本和依赖项也进行了相应更新,以支持这一新功能。

Changes

文件 更改摘要
.husky/pre-commit 新增文件,包含命令 npx lint-staged
package.json 更新 "prepare" 脚本为 "husky && dumi setup";新增 "lint-staged" 配置,指定所有文件使用 Prettier 格式化;添加依赖项 "husky": "^9.1.5""lint-staged": "^15.2.9"

Poem

🐰 在代码的草地上,
新钩子跳跃欢畅,
检查 lint,确保美,
提交前,质量高,
兔子舞动,乐无穷!
代码如花,绽放光芒! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 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.

Copy link

codecov bot commented Aug 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.21%. Comparing base (3927d01) to head (656c944).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1062   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files          39       39           
  Lines        1458     1458           
  Branches      435      406   -29     
=======================================
  Hits         1432     1432           
  Misses         26       26           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3927d01 and 656c944.

Files selected for processing (2)
  • .husky/pre-commit (1 hunks)
  • package.json (2 hunks)
Files skipped from review due to trivial changes (1)
  • .husky/pre-commit
Additional comments not posted (4)
package.json (4)

35-35: 更新 prepare 脚本以包含 Husky。

此更改将 Husky 集成到 prepare 脚本中,确保在执行 dumi setup 之前运行 Husky。这是一个合理的改动,因为它确保了 Git 钩子在项目准备阶段被正确设置。


43-45: 添加 lint-staged 配置。

此配置确保在提交前对所有暂存文件执行 Prettier 格式化。这是一个有效的方法来保持代码质量和一致性。请确保项目中已经安装了 Prettier,并且所有开发者都了解这一变更。


73-73: 添加 Husky 依赖。

通过将 Husky 添加到 devDependencies,确保了开发环境中 Git 钩子的可用性。版本号 "^9.1.5" 表明采用了兼容性较好的版本策略。


76-76: 添加 lint-staged 依赖。

将 lint-staged 添加到 devDependencies,支持提交前的代码质量检查。版本号 "^15.2.9" 同样采用了兼容性较好的版本策略。

@afc163 afc163 merged commit 11ae2ad into master Aug 31, 2024
11 checks passed
@afc163 afc163 deleted the chore/pre-commit branch August 31, 2024 15:06
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.

1 participant