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

fix(migrate): properly handle rule removal and insertion #3207

Merged
merged 7 commits into from
Jun 14, 2024

Conversation

Sec-ant
Copy link
Member

@Sec-ant Sec-ant commented Jun 13, 2024

Summary

Sorry about the diff. I had to rename most of the variables to understand the code.

Test Plan

Added several test cases where the nursery rule to migrate is present in different positions. I also tested the repo provided in #3179.

@github-actions github-actions bot added the A-CLI Area: CLI label Jun 13, 2024
@Sec-ant Sec-ant force-pushed the fix/nursery-rule-migration branch 3 times, most recently from 42f2099 to 9ab5f71 Compare June 14, 2024 03:56
@Sec-ant Sec-ant force-pushed the fix/nursery-rule-migration branch from 9ab5f71 to 6b290f7 Compare June 14, 2024 03:56
@github-actions github-actions bot added the A-Changelog Area: changelog label Jun 14, 2024
@Sec-ant Sec-ant marked this pull request as ready for review June 14, 2024 04:18
@ematipico
Copy link
Member

The schema seems not updated, for example it still sees useImportRestrictions as a nusery rule. What should I do to update the schema?

I'm not sure what you mean, useImportRestrictions is in nursery, currently.

@Sec-ant
Copy link
Member Author

Sec-ant commented Jun 14, 2024

The schema seems not updated, for example it still sees useImportRestrictions as a nusery rule. What should I do to update the schema?

I'm not sure what you mean, useImportRestrictions is in nursery, currently.

It's defined in the RULES_TO_MIGRATE:

("useImportRestrictions", ("style", "useImportRestrictions")),

@ematipico
Copy link
Member

Oh, shoot, that's a mistake. It was meant for promotion, discussed it and decided to revert the change. I forgot to revert that too. We should remove it, it's a bug

@Sec-ant
Copy link
Member Author

Sec-ant commented Jun 14, 2024

Oh, shoot, that's a mistake. It was meant for promotion, discussed it and decided to revert the change. I forgot to revert that too. We should remove it, it's a bug

I will fix it in this PR. Anyway it's a good bug because it helps us catch this bug :)

@Sec-ant Sec-ant requested review from a team June 14, 2024 07:09
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Left a suggestion. Thank you for fixing this! I admit, I wasn't expecting a case of double rules

crates/biome_migrate/src/analyzers/nursery_rules.rs Outdated Show resolved Hide resolved
@Sec-ant Sec-ant merged commit 4c4e502 into main Jun 14, 2024
13 checks passed
@Sec-ant Sec-ant deleted the fix/nursery-rule-migration branch June 14, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 npx @biomejs/biome migrate command crashes
2 participants