feat(import): enforce consistent types imports and ban usage of inline type specifiers#1382
Open
susnux wants to merge 2 commits into
Open
feat(import): enforce consistent types imports and ban usage of inline type specifiers#1382susnux wants to merge 2 commits into
susnux wants to merge 2 commits into
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
…plugin-import` Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Import like `import { type foo } from '...'` can lead to various
problems, or at least unexpected behavior.
Such as with verbatim module option it will become `import {} from ''`
instead of completely removed when transpiled.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
ce82241 to
71daed2
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
Is there any problem with https://typescript-eslint.io/rules/consistent-type-imports/ ? |
Contributor
Author
|
@ShGKme yes it does not work - does something different: What it actually does is adding - import { Type } from 'module'
+ import type { Type } from 'module' |
Contributor
|
Indeed |
ShGKme
approved these changes
Apr 20, 2026
max-nextcloud
approved these changes
Apr 20, 2026
benjaminfrueh
approved these changes
Apr 20, 2026
pringelmann
approved these changes
Apr 21, 2026
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.
Import like
import { type foo } from '...'can lead to variousproblems, or at least unexpected behavior.
Such as with verbatim module option it will become
import {} from ''instead of completely removed when transpiled.
This PR copies the rule from the import plugin because currently the plugin has no ESLint v10 compatibility but also in general it is quite a heavy plugin and has known limitations. But the rule itself is pretty lightweight.
So I copied the rule, adjusted it for ESLint v10 and migrated it to Typescript.
tests fail because for proper output we need #1379