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

[project] husky 초기세팅 #17

Merged
merged 12 commits into from
Jan 2, 2024
Merged

[project] husky 초기세팅 #17

merged 12 commits into from
Jan 2, 2024

Conversation

Jun-min2
Copy link
Contributor

@Jun-min2 Jun-min2 commented Dec 31, 2023

🔥 Related Issues

💜 작업 내용

  • husky 초기세팅

✅ PR Point

  • lint-staged와 pre-commit을 통해 커밋 시 오류가 발생하면 커밋이 안되는거에 대해서 확인했습니다.
    하지만 eslint와 prettier가 우선적으로 완료되지 않아, 아직 부족한게 있을 수 있어용...

😡 Trouble Shooting

  • husky 등장배경: eslint나 prettier를 통해서 오류가 나타나거나 어느정도 자동수정이 되더라도
    사람인지라 실수로 모든 것을 수정하지 못하였을 때 커밋하는 것을 방지함!

  • husky란? git hook 사용을 도와주는 라이브러리
    → git hook은 git이 어떤 이벤트가 생겼을 때 자동으로 특정한 스크립트를 실행하도록 함!

  • lint-staged란? 내가 add한 파일들( staged 상태)에 대해서 lint와 설정한 명령어를 실행하도록 하는 라이브러리

☀️ 스크린샷 / GIF / 화면 녹화

📚 Reference

  • 구현에 참고한 링크 (필요한 경우만 작성하고 없으면 지우기)
    참고

@Jun-min2 Jun-min2 added the ⚙ Setting 개발 환경 세팅 label Dec 31, 2023
@Jun-min2 Jun-min2 added this to the Init milestone Dec 31, 2023
@Jun-min2 Jun-min2 self-assigned this Dec 31, 2023
Copy link
Member

@eonseok-jeon eonseok-jeon left a comment

Choose a reason for hiding this comment

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

To. 준민
저희가 사용하는 lint는 eslint, stylelint, prettier가 있으므로 이 세 가지를 다 검사해주셔야 해요!!
지금은 제가 추가했지만 다음 번 프로젝트에선 이 부분도 신경 써주시면 좋을 듯 합니다!
husky와 lint staged 쉽지 않은데 정말 잘 해주셨어요!! 고생하셨습니다 :)

To. 모두들
eslint, stylelint와 prettier 에러 관련 테스트 완료했습니다 ◡̈
사실 prettier는 cmd + s 할 시 자동으로 고쳐줘서 에러 날 일이 없기에 없어도 될 거 같지만
혹여나 prettier 자동 수정 안 해주고 (ex. 모종의 이유로 prettier extension을 disabled 했을 때 등) commit 하려고 할 때 에러가 발생하는 것이 아닌 자동으로 수정되게 했습니다
본인 코드에서도 실행 되는지 확인들 해보시고
(바쁘면 스킵하세용~ 뭐 잘 되겠지 ㅋ)
코드 관련해서 궁금하신 점 있으시면 코멘트 남겨주세요

!! trouble shooting !!
스크린샷 2023-12-31 오후 6 34 56
위와 같은 오류가 뜨면서 husky가 작동이 안 된다면
스크린샷 2023-12-31 오후 5 45 07

이 2개의 명령어를 실행해보세요

@Jun-min2
Copy link
Contributor Author

감사합니다! 이번 초기세팅을 하면서 자주 사용하는 라이브러리들에 대해 알게되는 계기가 되었습니다!

Copy link
Contributor

@Yeonseo-Jo Yeonseo-Jo left a comment

Choose a reason for hiding this comment

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

image

husky 잘 작동하는거 확인했습니다!
husky 설치자 외 다른 사람들은

  1. yarn
  2. yarn postinstall
    로 husky 깔아주고 작업해야 husky가 돌아갑니다!
    (-> 전 프로젝트에서 이거 몰랐다가 나만 husky한테 잡혔던 일화가 . . 🐶)

Comment on lines +16 to +21
"lint-staged": {
"src/**/*.{ts,tsx}": [
"eslint --fix",
"stylelint --fix",
"prettier --write"
]
Copy link
Contributor

Choose a reason for hiding this comment

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

굿굿! 야무지게 3개 다 잘 걸어주셨군요 최고최고

Copy link
Contributor Author

Choose a reason for hiding this comment

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

언석형의 도움으로 되지 않았나.. 생각합니다

package.json Outdated
Comment on lines 11 to 12
"prepare": "husky install",
"postinstall": "husky install",
Copy link
Contributor

Choose a reason for hiding this comment

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

prepare와 postinstall 두 개 다 써준 이유가 궁금합니다!
특별한 이유가 없다면 postinstall만 사용해도 괜찮을것 같아요
husky 공식 문서에서도 postinstall로 예시를 써주고 있고,
이 링크에서도 postinstall을 권하고 있네요! 한 번 읽어보면 좋을것 같습니다

src/App.tsx Outdated
Comment on lines 6 to 10
const Text = styled.div`
width: 100%;
height: 100%;
border: 1px;
`;
Copy link
Contributor

Choose a reason for hiding this comment

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

테스트 코드 지워주기 ~

@Jun-min2 Jun-min2 merged commit a873f20 into feat/init Jan 2, 2024
@Yeonseo-Jo Yeonseo-Jo deleted the init/#14/husky branch February 16, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙ Setting 개발 환경 세팅
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants