Skip to content

feat(import): enforce consistent types imports and ban usage of inline type specifiers#1382

Open
susnux wants to merge 2 commits into
mainfrom
feat/no-types-import
Open

feat(import): enforce consistent types imports and ban usage of inline type specifiers#1382
susnux wants to merge 2 commits into
mainfrom
feat/no-types-import

Conversation

@susnux
Copy link
Copy Markdown
Contributor

@susnux susnux commented Apr 19, 2026

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.

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

@susnux susnux added enhancement New feature or request 3. to review labels Apr 19, 2026
@susnux susnux requested review from ShGKme and max-nextcloud April 19, 2026 20:44
@max-nextcloud

This comment was marked as resolved.

susnux added 2 commits April 20, 2026 10:34
…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>
@susnux susnux force-pushed the feat/no-types-import branch from ce82241 to 71daed2 Compare April 20, 2026 09:31
@susnux

This comment was marked as resolved.

@susnux susnux marked this pull request as ready for review April 20, 2026 10:38
@ShGKme
Copy link
Copy Markdown
Contributor

ShGKme commented Apr 20, 2026

Is there any problem with https://typescript-eslint.io/rules/consistent-type-imports/ ?

@ShGKme
Copy link
Copy Markdown
Contributor

ShGKme commented Apr 20, 2026

Indeed

Copy link
Copy Markdown
Contributor

@max-nextcloud max-nextcloud left a comment

Choose a reason for hiding this comment

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

So much nicer! Thanks!

Tested locally with the code that triggered the discussion for me. Works like a charm.

@susnux susnux changed the title [RFC] feat(import): enforce consistent types imports and ban usage of inline type specifiers feat(import): enforce consistent types imports and ban usage of inline type specifiers Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Separate type imports from other imports

5 participants