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

Switch to inline type imports #1732

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Switch to inline type imports #1732

wants to merge 1 commit into from

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jan 15, 2025

The idea is to avoid duplicate imports (one for types and one for values). Having the type keyword right before each import is also clearer in my opinion.

Of course, you win some, you lose some: when importing a lot of types from the same module, we get a lot of type keywords, which can also lead to Prettier wrapping imports onto separate lines, which is why slightly more lines are added than removed in the diff.

@@ -16,6 +16,7 @@
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.preferTypeOnlyAutoImports": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oversight: I had this in my user settings instead of in the project's settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a comment to surface the ESLint config changes that make all this happen.

@axelboc axelboc requested a review from loichuder January 15, 2025 10:44
@axelboc axelboc force-pushed the inline-type-imports branch from faa9420 to 746f43f Compare January 15, 2025 14:40
@axelboc axelboc force-pushed the inline-type-imports branch 2 times, most recently from e802e29 to faebae3 Compare January 17, 2025 13:19
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