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

feat(assist/organizeImports): add an option to separate types #5582

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Apr 6, 2025

Summary

This PR should be merged after #5579
It adds a way of separating import type and export type from regular import and export.

When the option typePlacement is set to separated, type-only imports and exports are placed first.
They are separated from regular imports and exports with a blank line.

To implement this feature, I introduced an extra field on import keys: section.
section takes precedence over group.

Test Plan

I added some tests.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Apr 6, 2025
@Conaclos Conaclos requested review from a team April 6, 2025 20:01
@Conaclos Conaclos changed the title feat(assist/organizeImports): add option to separate types feat(assist/organizeImports): add an option to separate types Apr 6, 2025
Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

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

Nice!

What I don't entirely understand yet is the practical implications of this versus the suggested :TYPES: and what are the pros/cons of each approach.

Also left a suggestion for making the sections a bit more semantic.

@Conaclos
Copy link
Member Author

Conaclos commented Apr 7, 2025

What I don't entirely understand yet is the practical implications of this versus the suggested :TYPES: and what are the pros/cons of each approach.

The issue with :TYPES: is that import type/export type are placed in a single group.
By using sections, we can still group them according to groups.

Base automatically changed from conaclos/organizeImports-merging to main April 7, 2025 19:39
@Conaclos Conaclos force-pushed the conaclos/organizeImports-separate-types branch 2 times, most recently from b65da39 to 0c17e35 Compare April 7, 2025 20:18
@Conaclos Conaclos merged commit 2d699e3 into main Apr 7, 2025
13 checks passed
@Conaclos Conaclos deleted the conaclos/organizeImports-separate-types branch April 7, 2025 20:34
Copy link

codspeed-hq bot commented Apr 7, 2025

CodSpeed Performance Report

Merging #5582 will not alter performance

Comparing conaclos/organizeImports-separate-types (0c17e35) with main (f6db30d)

Summary

✅ 95 untouched benchmarks

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

Successfully merging this pull request may close these issues.

2 participants