Skip to content

@remotion/studio-server: Remove duplicate codemod formatting logic#6994

Merged
JonnyBurger merged 4 commits intomainfrom
cursor/trivial-issue-resolution-43bb
Apr 4, 2026
Merged

@remotion/studio-server: Remove duplicate codemod formatting logic#6994
JonnyBurger merged 4 commits intomainfrom
cursor/trivial-issue-resolution-43bb

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Apr 4, 2026

Summary

  • Addresses Remove duplicate code in codemods #6993 by removing duplicated Prettier formatting boilerplate in codemods.
  • Added a shared helper formatFileContent() in packages/studio-server/src/codemods/format-file-content.ts.
  • Reused the helper in:
    • delete-jsx-node.ts
    • update-sequence-props.ts

Why

Both codemods had nearly identical logic for:

  • lazy-loading Prettier,
  • resolving config / applying override,
  • formatting TSX output,
  • and falling back to unformatted output.

Centralizing this reduces maintenance overhead and keeps behavior aligned.

Behavior / tradeoffs

  • No intended behavioral change.
  • Existing fallback semantics are preserved (formatted: false when Prettier/config is unavailable).
  • End-of-line, filepath, and plugin settings remain the same.

Validation

  • Code changes are isolated to codemods and a new local helper.
  • Could not run the requested Bun tests in this execution environment because Bun is unavailable on PATH and ~/.bun/bin/bun is missing.
Open in Web View Automation 

Co-authored-by: Jonny Burger <hi@jonny.io>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Apr 4, 2026 4:45pm
remotion Ready Ready Preview, Comment Apr 4, 2026 4:45pm

Request Review

Co-authored-by: Jonny Burger <hi@jonny.io>
Co-authored-by: Jonny Burger <hi@jonny.io>
Co-authored-by: Jonny Burger <hi@jonny.io>
@JonnyBurger JonnyBurger marked this pull request as ready for review April 4, 2026 16:44
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Apr 4, 2026

Reviewed PR #6994. The two extractions (formatFileContent and getAstNodePath) are correct and behavior-preserving. Flagged that duplicate-jsx-node.ts has an identical copy of the Prettier formatting boilerplate that was not migrated — the most obvious third consumer of the new helper was missed.

Task list (5/5 completed)
  • Read the full diff and understand the changes
  • Read original files to verify correctness of extraction
  • Check for other callers/consumers of the extracted helpers
  • Verify the getAstNodePath extraction doesn't miss existing usage
  • Submit review

Pullfrog  | View workflow run | Triggered by Pullfrog | Using Big Pickle (free) | 𝕏

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

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

duplicate-jsx-node.ts has the same Prettier formatting boilerplate (lines 451–507) and was not migrated to formatFileContent. This defeats the purpose of the consolidation — the most obvious third consumer was missed.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Big Pickle (free) | 𝕏

output: prettified,
formatted: true,
};
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

duplicate-jsx-node.ts (lines 451–507) has an identical copy of this formatting logic that should also be migrated to formatFileContent. It follows the exact same pattern — lazy-load Prettier, resolve config with override, format TSX, fall back to unformatted — and is structurally identical to the code removed from delete-jsx-node.ts and update-sequence-props.ts.

@JonnyBurger JonnyBurger merged commit 5998180 into main Apr 4, 2026
20 checks passed
@JonnyBurger JonnyBurger deleted the cursor/trivial-issue-resolution-43bb branch April 4, 2026 16:54
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

Successfully merging this pull request may close these issues.

2 participants