Skip to content

feat: husky 설정#11

Closed
meteorqz6 wants to merge 3 commits intomainfrom
10-기능추가husky

Hidden character warning

The head ref may contain hidden characters: "10-\uae30\ub2a5\ucd94\uac00husky"
Closed

feat: husky 설정#11
meteorqz6 wants to merge 3 commits intomainfrom
10-기능추가husky

Conversation

@meteorqz6
Copy link
Contributor

@meteorqz6 meteorqz6 commented Jun 3, 2025

commit-msg : commitlint 기반으로 설정
pre-push : 3개의 명령어 중 어떤 명령어에서든 실패하면 push가 즉시 중단된다

Summary by CodeRabbit

  • Chores
    • 커밋 메시지 표준 준수를 위한 자동 Git 훅 도입 및 푸시 전 코드 품질 검사 실행.
    • 커밋 메시지 린팅과 Git 훅 관리를 위한 설정 파일 및 의존성 추가.
    • CodeRabbit AI 통합을 위한 새로운 설정 파일 추가.
  • Style
    • 린트 스크립트의 사소한 형식 수정.

@meteorqz6 meteorqz6 linked an issue Jun 3, 2025 that may be closed by this pull request
@coderabbitai
Copy link

coderabbitai bot commented Jun 3, 2025

Caution

Review failed

The pull request is closed.

## Walkthrough

이번 변경은 Husky를 활용한 Git 훅을 도입하여 커밋 메시지 린팅과 푸시 전 검사(Expo 진단, 린팅, TypeScript 검증)를 자동화합니다. 또한 commitlint 설정 파일과 package.json에 관련 스크립트 및 개발 의존성을 추가해 커밋 규칙과 코드 품질을 강화합니다.

## Changes

| File(s)                    | Change Summary                                                                                         |
|----------------------------|------------------------------------------------------------------------------------------------------|
| .husky/commit-msg, .husky/pre-push | 커밋 메시지 린팅과 푸시 전 Expo 진단, 린팅, 타입스크립트 검사를 수행하는 Git 훅 스크립트 추가                |
| commitlint.config.js        | commitlint의 표준 커밋 메시지 규칙을 적용하는 설정 파일 추가                                         |
| package.json               | Husky 초기화 스크립트 추가, commitlint 관련 개발 의존성 추가 및 lint 스크립트 포맷 수정                  |
| .coderabbit.yaml           | CodeRabbit AI 통합을 위한 설정 파일 신규 추가                                                         |

## Poem

> 굴 속 토끼들 환호하네,  
> Husky 훅이 왔으니 기쁘다네!  
> 린트와 검사 푸시 전마다,  
> 코드 깨끗해져 걱정 없네.  
> 커밋메시지 길잡이 되어,  
> 모든 점프가 즐거움 되네.  
> 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-04T02_15_41_158Z-debug-0.log


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6e7760 and 0bdd374.

📒 Files selected for processing (2)
  • .coderabbit.yaml (1 hunks)
  • commitlint.config.js (1 hunks)
✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

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

@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: 1

🧹 Nitpick comments (1)
.husky/pre-push (1)

1-4: Excellent pre-push validation setup!

The pre-push hook is well-structured with proper error handling using set -e. The sequence of checks (Expo diagnostics → linting → TypeScript) provides comprehensive validation before pushing code.

Consider adding a comment to inform developers about the expected execution time, as these checks might slow down the push process.

You could add a comment for better developer experience:

+# Pre-push checks: This may take a few moments
 set -e
 npx expo-doctor
 npm run lint
 npx tsc --noEmit
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7991133 and b6e7760.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .husky/commit-msg (1 hunks)
  • .husky/pre-push (1 hunks)
  • commitlint.config.js (1 hunks)
  • package.json (2 hunks)
🔇 Additional comments (3)
.husky/commit-msg (1)

1-1: LGTM! Proper commitlint integration.

The commit-msg hook is correctly configured to validate commit messages using commitlint with the conventional commit standards.

commitlint.config.js (1)

1-1: Verify ES module syntax compatibility.

The configuration correctly extends the conventional commit preset. However, ensure that your Node.js version and project configuration support ES module syntax.

If you encounter issues with ES modules, consider using CommonJS syntax instead:

-export default { extends: ["@commitlint/config-conventional"] };
+module.exports = { extends: ["@commitlint/config-conventional"] };

Or ensure your package.json includes "type": "module" to enable ES modules project-wide.

package.json (1)

11-11: Good addition of Husky prepare script.

The prepare script will automatically set up Husky Git hooks when developers run npm install, ensuring consistent setup across the team.

Comment on lines +26 to +27
"@commitlint/cli": "^19.8.1",
"@commitlint/config-conventional": "^19.8.1",
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify the lint script works with the pre-push hook.

The commitlint and Husky dependencies are correctly added. However, ensure that the lint script (line 10) works properly since it's referenced in the pre-push hook.

Run the following script to verify the lint command works as expected:

Also applies to: 33-33


🏁 Script executed:

#!/bin/bash
# Description: Verify that the lint script runs successfully
# Expected: The lint command should execute without errors

echo "Testing lint script..."
npm run lint
echo "Lint script test completed"

Length of output: 196


Add ESLint as a local devDependency so the lint script can run

The lint script is currently invoking eslint . but eslint isn’t installed in your project. To fix this, add ESLint (and any needed plugins/configs) to your devDependencies in package.json.

• In package.json under devDependencies, add:

{
  "devDependencies": {
+   "eslint": "^8.40.0",
    "@commitlint/cli": "^19.8.1",
    "@commitlint/config-conventional": "^19.8.1",
    // …other deps
  }
}

• Then run:

npm install --save-dev eslint

to install it locally.
After that npm run lint (and your pre-push hook) will succeed.

🤖 Prompt for AI Agents
In package.json around lines 26 to 27, ESLint is missing from devDependencies,
causing the lint script to fail. Add ESLint to the devDependencies section by
specifying the appropriate version, then run npm install --save-dev eslint to
install it locally. This will ensure the lint script runs successfully and the
pre-push hook works as intended.

@meteorqz6 meteorqz6 closed this Jun 4, 2025
@meteorqz6 meteorqz6 deleted the 10-기능추가husky branch June 4, 2025 02:19
@meteorqz6 meteorqz6 removed a link to an issue Jun 4, 2025
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