Set up prettier-plugin-organize-imports#1250
Closed
Arman-Luthra wants to merge 2 commits into
Closed
Conversation
Adds prettier-plugin-organize-imports so pnpm format sorts imports and removes unused ones, and enables organize-imports-on-save in VS Code. Closes Shopify#540 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mechanical diff from running pnpm format with prettier-plugin-organize-imports enabled. No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are you adding in this PR?
Closes #540.
This sets up
prettier-plugin-organize-importsas requested in the issue and the linked review discussion on #529, sopnpm formatnow sorts imports and removes unused ones.The work is split into two commits so the mechanical diff is reviewable on its own, as suggested in that discussion:
prettier-plugin-organize-imports@4.3.0to the workspace root devDependencies, registers it in.prettierrc.json, and addseditor.codeActionsOnSave: { "source.organizeImports": "explicit" }to.vscode/settings.json. Peer requirements are satisfied by the repo's existing prettier^3.0.0and typescript^5.9.0.pnpm formatacross the workspace, organizing imports in 473 files.An empty changeset is included, since this is tooling-only and changes no published package behavior.
One risk with this plugin is that it can drop imports that exist only for side effects. I checked the formatted scope for those: the single side-effect-only import (
test-setupinLiquidDocTagHoverProvider.spec.ts) survived the reformat, and the type-check plus full test suite pass covers the rest.What's next? Any followup issues?
None. If this sits for a while before merge, the mechanical commit may need a fresh rebase to avoid conflicts; happy to redo it on request.
Tophatting
pnpm format:checkpasses after the reformat, so the output is stable and idempotentpnpm build:tsandpnpm type-checkpass across all packages with zero errorspnpm vitest runpasses the full suite: 296 test files, 1882 passed, 1 skippedpnpm lintreports 17 pre-existing problems invscode-extensionthat reproduce identically on an unmodified checkout, so they are unrelated to this changeBefore you deploy