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

chore(migrate): remove version check #4990

Open
wants to merge 8 commits into
base: next
Choose a base branch
from

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Jan 28, 2025

Summary

This PR fixes a number of issues in our migration rules:

  • Remove the TheVersion service. It's not needed anymore. Less code :)
  • Remove the check of rome.json inside the migration. We removed it, and we don't handle it anymore. Hence, the field configration_directory_path isn't needed anymore.
  • Fixed the style rules migration, in particular the logic inside the rule move type.
    • It doesn't remove existing members anymore.
    • It always adds the correct number of separators, so it won't emit incorrect CST (this was causing the infinite loop)
    • I removed the useWhile from the styling rules because it's handled by use_while.rs. This was causing another infinite loop where useWhile and styleRules were creating one action after the other... lol!
  • The migration command now formats the code at the very end. I'm surprised it didn't 😅

Test Plan

Our biome.json was causing the loop, so I added it as a test case in our testing suite.

I also run the migration to our biome.json and made sure there wasn't a loop anymore

@github-actions github-actions bot added the A-CLI Area: CLI label Jan 28, 2025
Comment on lines +489 to +493
let new_linter_member = add_members_to_linter_member(
&linter_member,
linter_members.clone(),
linter_separators.clone(),
);
Copy link
Member Author

Choose a reason for hiding this comment

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

The first implementation was adding the new member at the very end. While it's more efficient, it basically moves around an existing member, causing plenty of diffs.

I decided that it's best to pay a bit more in memory, but at least we do swap the members in the same position, so the number the final diff is very limited.

@ematipico ematipico requested review from Conaclos and dyc3 January 28, 2025 17:43
@ematipico ematipico force-pushed the chore/remove-version-check-in-rules branch from 543f398 to ad4da5c Compare January 29, 2025 14:03
@github-actions github-actions bot added A-Parser Area: parser L-JSON Language: JSON and super languages labels Jan 29, 2025
@ematipico
Copy link
Member Author

ematipico commented Jan 29, 2025

@dyc3 @Conaclos

Here's an update. The RuleMover project I had in mind was a failure. It was becoming too complex and it was full of all sort of bugs. I fixed enough bugs to make it working for the displayRules, and I removed its usage in the other rules.

I ran the PR against the ecosystem and found three projects that were failing. Hence, I also added their configuration files in the migrate_v2.rs test file. This should cover most of the cases, and we should be able to catch possible loops early enough.

Apologies for the problems caused, but the migration should be stable now :)

@Conaclos
Copy link
Member

Thanks for the update!

Hence, I also added their configuration files in the migrate_v2.rs test file

Have you tried to reduce to a minimal reproduction fore every failure?

@ematipico
Copy link
Member Author

Yes, the failures were due to RuleMover, which I removed from the rules. I then updated the single migrations against regressions.

We required bigger configs to test all the migrations together. However, the majority of the issues were around the move of rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Parser Area: parser L-JSON Language: JSON and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants