-
Notifications
You must be signed in to change notification settings - Fork 48
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
Component enum property rule proposal #1568
Labels
enhancement
Issues or PR related to making existing features better
Comments
마이그레이션 전략
|
@Dogdriip 이 이슈 + 마이그레이션 코드 구현 및 문서 작성해보시면 좋을 거 같아요! |
9 tasks
sungik-choi
pushed a commit
that referenced
this issue
Sep 14, 2023
…eprecate enum (#1595) <!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English**. - [x] I added an appropriate **label** to the PR. - [x] I wrote a commit message in **English**. - [x] I wrote a commit message according to [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] [I added the appropriate **changeset**](https://github.com/channel-io/bezier-react/blob/main/CONTRIBUTING.md#add-a-changeset) for the changes. - [ ] [Component] I wrote **a unit test** about the implementation. - [ ] [Component] I wrote **a storybook document** about the implementation. - [ ] [Component] I tested the implementation in **various browsers**. - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox - [ ] [*New* Component] I added my username to the correct directory in the `CODEOWNERS` file. ## Related Issue - #1568 ## Summary <!-- Please add a summary of the modification. --> - `ProgressBar` 컴포넌트의 SizeProps인 `ProgressBarSize`, VariantProps인 `ProgressBarVariant`에 enum 대신 string literal type이 들어갈 수 있도록 변경하고, enum을 deprecated 처리합니다. ## Details <!-- Please add a detailed description of the modification. (such as AS-IS/TO-DO)--> ## Breaking change or not (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> - No - 향후 `ProgressBarSize`, `ProgressBarVariant` enum 사용처에서 이를 string literal로 변경해주어야 합니다. ## References <!-- External documents based on workarounds or reviewers should refer to -->
6 tasks
Closed
6 tasks
yangwooseong
added a commit
that referenced
this issue
Feb 8, 2024
… Banner, etc (#1984) <!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Related Issue <!-- Please link to issue if one exists --> <!-- Fixes #0000 --> - #1815 - #1568 ## Summary <!-- Please brief explanation of the changes made --> - 컴포넌트의 enum 타입을 string literal 타입으로 변경하고 codemod 에 변경되는 속성을 추가합니다. - 한 pr 에 하기에는 변경사항이 많아서 2~3개로 분리해서 작업하려고 합니다. ## Details <!-- Please elaborate description of the changes --> - `v2-enum-member-to-string-literal` codemod 를 사용해서 하나씩 변환했습니다. - 스토리북에서 enum 으로부터 control option 을 얻어오는 부분은 string literal 타입이 되면 스토리북이 알아서 radio 버튼으로 바꿔주기 때문에 제거했습니다. 개발 모드에서는 input type으로 되어 직접 입력해야하지만, 크게 불편하지는 않다고 생각됩니다. - StatusType 만 'OnlineCrescent' 처럼 PascalCase 로 되어있고 다른 부분은 kebab-case 라서 변환하면서 모두 kebab-case 로 통일해야 하나 고민입니다. 일관성 측면에서 통일하는게 좋아보입니다. ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> - Yes ## References <!-- Please list any other resources or points the reviewer should be aware of --> - None
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
컴포넌트의 enum 속성 컨벤션 변경을 제안합니다. enum을 모두 union string literal로 통일합니다.
Reasons for suggestion
enum의 문제
beizer-react에선 size, variants등의 값에
***Size
,***Variants
같은 enum을 사용하고 있습니다. string literal을 사용할 수도 있지만, 소스 코드 검색 시에 enum이 가지는 이점이 있어 사용하게 되었습니다. 반면 enum이 장점만을 가지는 것은 아닙니다.단점
Stack
의justify
나align
속성은 enum이 아닌 string literal로 되어있습니다. 명확한 기준을 정하기도 어렵습니다기존 장점이었던 '소스 코드 검색의 용이성'은 특히 마이그레이션을 하는 경우 빛을 발하게 되는데, 이제는 codemod 스크립트를 통해 AST를 탐색하여 마이그레이션을 할 수 있습니다. 현 시점에서 이 장점을 유지하기 위한 비용보다 단점에서 오는 비용이 훨씬 더 크다고 생각합니다.
Proposed solution
enum을 모두 union (string or number) literal로 통일합니다.
마이그레이션 시 장점
as ButtonSize
같은)마이그레이션 시 단점
ButtonColorVariant.Monochrome
)References
Tasks
ProgressBarSize
,ProgressBarVariant
string literal type and deprecate enum #1595The text was updated successfully, but these errors were encountered: