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

[FE] eslint 설정 추가 세팅 #417 #418

Merged
merged 6 commits into from
Mar 12, 2025
Merged

[FE] eslint 설정 추가 세팅 #417 #418

merged 6 commits into from
Mar 12, 2025

Conversation

Zero-1016
Copy link
Member

@Zero-1016 Zero-1016 commented Mar 12, 2025

📎 연관 이슈

해결된 이슈: close #417

✏️ 작업 내용

현재 프로젝트의 코드 품질 향상을 위해 ESLint를 설정하였습니다.

ESLint 설정

다음과 같은 규칙들을 추가하여 코드 품질을 향상시켰습니다.

{
  "rules": {
    // console.log 사용 제한 (warn, error만 허용)
    "no-console": ["error", { "allow": ["warn", "error"] }],
    
    // React Hooks 규칙 준수
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  }
}

또한 type, lint, format 검사는 git action을 이용하여 dev/fe에 병합하거나 푸시를 할 경우 실행됩니다.

🙏🏻 리뷰 요구 사항

ESLint 설정에 대해 다음 사항들을 검토해주시면 감사하겠습니다.

ESLint 규칙

  • console.log 사용을 제한하고 warn, error만 허용하도록 설정

console.log를 사용하고 싶다면 utils/log를 사용하거나 commit 단계전에 제거를 하셔야합니다.

import { errorLog, log } from '@/utils/log'

log('[✅] 이미 채팅 서버에 연결되어 있음')
  • React Hooks 규칙을 엄격하게 적용하여 잠재적인 버그 방지
  • useEffect의 의존성 배열 누락 시 경고 표시

다음과 같이 의존성 배열 누락 경고를 제거할 수 있습니다.

  /*
   * 채널 입장 및 퇴장 이벤트를 처리하는 함수
   * 무한 루프 방지를 위해 exhaustive-deps 규칙을 비활성화합니다.
   */
  useEffect(() => {
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [channelId, channelInfoList, serverId])

해당 방식의 남용을 방지하기 위해 해당 규칙 무시 룰을 사용할 경우 위에 주석으로 사용한 이유를 명시해 주시기 바랍니다.

@Zero-1016 Zero-1016 added frontend 프론트엔드 라벨 chore labels Mar 12, 2025
@Zero-1016 Zero-1016 self-assigned this Mar 12, 2025
@Zero-1016 Zero-1016 requested a review from mnbvcxzyj March 12, 2025 11:13
@Zero-1016 Zero-1016 changed the title [FE] eslint 설정 추가 및 husky 세팅 #417 [FE] eslint 설정 추가 세팅 #417 Mar 12, 2025
@Zero-1016 Zero-1016 merged commit 94804f2 into dev/fe Mar 12, 2025
4 checks passed
@Zero-1016 Zero-1016 deleted the fe/chore/#417 branch March 13, 2025 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore frontend 프론트엔드 라벨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant