Skip to content

fix: preserve statements between organized imports - #5

Open
everton-dgn wants to merge 1 commit into
webpro-nl:mainfrom
everton-dgn:fix/preserve-statements-between-imports
Open

everton-dgn wants to merge 1 commit into
webpro-nl:mainfrom
everton-dgn:fix/preserve-statements-between-imports

Conversation

@everton-dgn

Copy link
Copy Markdown

With organizeImports enabled, merging duplicate imports currently removes every statement between the first and last import. An exported value in that interval disappears, leaving its consumers broken.

Limit merging to import sequences with no intervening statements, and replace only the import declarations. This preserves statement boundaries in code without semicolons. Groups with TypeScript suppression directives stay intact so their comments keep the same targets.

Regressions exercise the public write API and run the resulting modules, checking exports and effect order. A compiler check also verifies that @ts-expect-error directives remain used. All 194 tests, build, lint and formatting passed on Node 24; installed-check passed with the unchanged dependency set.

With organizeImports enabled, merging duplicate imports currently removes every statement between the first and last import. An exported value in that interval disappears, leaving its consumers broken.

Limit merging to import sequences with no intervening statements, and replace only the import declarations. This preserves statement boundaries in code without semicolons. Groups with TypeScript suppression directives stay intact so their comments keep the same targets.

Regressions exercise the public write API and run the resulting modules, checking exports and effect order. A compiler check also verifies that @ts-expect-error directives remain used. All 194 tests, build, lint and formatting passed on Node 24; installed-check passed with the unchanged dependency set.
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.

1 participant