Skip to content

[eslint-*] v2 rc bugs #75

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

Closed
1 task done
yongholeeme opened this issue Jan 2, 2025 · 18 comments
Closed
1 task done

[eslint-*] v2 rc bugs #75

yongholeeme opened this issue Jan 2, 2025 · 18 comments
Assignees

Comments

@yongholeeme
Copy link
Contributor

yongholeeme commented Jan 2, 2025

  • react-hooks/rules-of-hooks
    한글 컴포넌트에서 에러 발생 [eslint-plugin-react-hooks] only allow capitalized component names facebook/react#25162
    Error: React Hook "useState" is called in function "한글" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use". react-hooks/rules-of-hooks
    • v5 부터 생긴 이슈, 대문자로 시작하는 컴포넌트 이름만 허용
    • v4 는 eslint peer dependencies 에서 eslint@9을 지원하지 않음
    • 근본룰이므로 일단 따라가고, 한글 컴포넌트 사용하는 쪽에서 자체적으로 대응하는 것으로 결정
@yongholeeme yongholeeme self-assigned this Jan 2, 2025
@yongholeeme
Copy link
Contributor Author

@NaverPayDev/frontend , eslint-plugin-react-hooks@5부터 eslint@9를 의존성으로 갖고 있는데 eslint-plugin-react-hooks@5부터 컴포넌트 이름이 반드시 대문자이어야하는 룰이 추가됐네요. 한글이름을 가진 컴포넌트도 고려가 되어야해서 상황이 꼬였는데요. 관련해서 코멘트를 남기긴 했지만 개인적인 의견으로는 rules-of-hooks는 훅이 나온 시점에서는 유용하지만 지금은 어느정도 기본적인 지식으로 느껴져 해당 룰을 제외할까 하는데 어떨까요?

@yceffort-naver
Copy link
Contributor

rules-of-hooks 가 대문자로 시작하는 컴포넌트명만 인식하는건가요?

@2-one-week
Copy link
Member

facebook/react#25162 (comment)

크으 간지.. 음..어렵네요

영어가 근본이긴한데, overriding 해서 warning 처리만 할까요??

@yongholeeme
Copy link
Contributor Author

rules-of-hooks 가 대문자로 시작하는 컴포넌트명만 인식하는건가요?

네, 이전에는 소문자로 시작하는 게 아니면 됐었는데, 이제는 대문자로 시작해야만 컴포넌트로 판단하네요.. https://github.com/facebook/react/pull/25162/files#diff-5649cc9bc31063c1139ad0f91e98add9c77f641281cba934123db8aeade0b97eR49

@yongholeeme
Copy link
Contributor Author

영어가 근본이긴한데, overriding 해서 warning 처리만 할까요??

@2-one-week 님, 그냥 룰을 끄는 건 아니고 warn 처리 하자는 말씀이시죠?

@2-one-week
Copy link
Member

그냥 룰을 끄는 건 아니고 warn 처리 하자는 말씀이시죠?

네넵 근데 저는 끄는 것도 괜찮다고 생각합니다 ㅋㅋㅋ 어차피 다들 습관적으로 영어로 하면 대문자로 하고 있어서??

@yongholeeme
Copy link
Contributor Author

개인적인 의견으로는 rules-of-hooks는 훅이 나온 시점에서는 유용하지만 지금은 어느정도 기본적인 지식으로 느껴져

이게 너무 개인적인 생각이라 말씀주신 것처럼 warn 도 좋을 것 같..

@2-one-week
Copy link
Member

https://github.com/facebook/react/pull/25162/files#diff-5649cc9bc31063c1139ad0f91e98add9c77f641281cba934123db8aeade0b97eR49

이거 그러면 react-hooks plugin 버전 저희가 고정하고, pnpm patch 처리해서 유니코드면 true 처리하도록 할까요?

@yceffort-naver
Copy link
Contributor

pnpm patch 처리해서 유니코드면 true 처리하도록 할까요?

근데 이거 끈채로 배포할수는 없어서...

@yceffort-naver
Copy link
Contributor

저는 메이저 가는김에 그냥 한글명 컴포넌트 다 바꾸라고 하는 것에 한표하겠습니다

@2-one-week
Copy link
Member

저는 메이저 가는김에 그냥 한글명 컴포넌트 다 바꾸라고 하는 것에 한표하겠습니다

요건 그러면 영어 컴포넌트 강제일까요?

C_계피...?

@yongholeeme
Copy link
Contributor Author

yongholeeme commented Jan 3, 2025

저는 메이저 가는김에 그냥 한글명 컴포넌트 다 바꾸라고 하는 것에 한표하겠습니다

영어로요? 안돼~ react-hooks/rules-of-hooks: 'off'

@2-one-week
Copy link
Member

근데 rule-of-hooks 내부에 useState나 effect deps 도 포함되어 있는거 아녀요??

@yceffort-naver
Copy link
Contributor

rules-of-hooks 끄는건 너무 위험하다 생각 ㅋㅋㅋ

@2-one-week
Copy link
Member

컨트리뷰션 가즈아~ 한국인 좀 살려줘~

@yongholeeme
Copy link
Contributor Author

근데 rule-of-hooks 내부에 useState나 effect deps 도 포함되어 있는거 아녀요??

아뇨, rule-of-hooks은 컴포넌트 내부에서 훅쓰는 것만 ! effect deps은 별도 룰로 있습니다.

@yongholeeme
Copy link
Contributor Author

yongholeeme commented Jan 3, 2025

일단 meta 의견에 맞게 대문자만 허용하는 걸로가고... 어떻게 대응할 지는 사용하는 쪽에서 선택하는 걸로..!

@yceffort-naver
Copy link
Contributor

예써

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

No branches or pull requests

3 participants