Skip to content

poc: claude code migration of flex #94855

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
wants to merge 2 commits into from
Closed

Conversation

JonasBa
Copy link
Member

@JonasBa JonasBa commented Jul 3, 2025

This is just a test of analyze-styled tool and claude code performing a migration.

I am performing a migration in where I would like to migrate all styled components like  │
│   styled(div) that only contain flex rules to instead use Flex component from                          │
│   components/core/layout. To do this, you can invoke a tool called analyzed-styled.ts via node         │
│   analyze-styled.ts, which will write the files that are candidates for change into                    │
│   analyze-styled.txt. The analyze styled script will create newline entries inside analyze-styled.txt  │
│   with the schema of ${file}:${line}:${column}                                                         │
│                                                                                                        │
│   Here are some things for you to know:                                                                │
│   - Read the implementation of analyze-styled.ts and look at the readme. I want you to call     │
│   the tool with -n 10 argument.
│   - Read the implementaton of our Flex component inside  components/core/layout so that you    │
│   understand it's API.                                                                                 │
│   - The script can produce false positives. If the change you are trying to make does not only         │
│   contain flex rules, but might contain sub selectors or some expression that is not flexbox related,  │
│   you should not make any changes to it.                                                                      │
│   - When replacing the component, do not use aliases like const Container = Flex, instead, use the     │
│   Flex directly.                                                                                       │
│   - Make sure to replace all occurrences in a given file that you are editing                            │
│   - Do not add any code comments                                                                           │
│   - Do not read README.md                                                                              │
│   Good luck

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 3, 2025
@JonasBa JonasBa force-pushed the jb/flex/migration-work branch from 7668bb0 to c4e816d Compare July 3, 2025 11:44
@@ -193,11 +194,6 @@ const InstructionsSection = styled('div')`
max-width: 800px;
`;

const ButtonBar = styled('div')`
Copy link
Member Author

Choose a reason for hiding this comment

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

ButtonBar 🤔

${p => p.theme.overflowEllipsis};
display: flex;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a mistake, it should not modify these instances because overflowEllipsis adds display: block, so this isn't actually using flex. Sort of expected that it tripped itself on this problem given that it's extending Column, which is using display: flex (I made that same mistake)

Comment on lines +12 to +15
// Override default flex styles for ProjectBadgeContainer
ProjectBadgeContainer.defaultProps = {
align: 'center',
};
Copy link
Member Author

@JonasBa JonasBa Jul 3, 2025

Choose a reason for hiding this comment

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

In this case, ProjectBadgeContainer should have become a react component that renders children and wrap them in flex

@JonasBa JonasBa closed this Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant