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: 🎸 add consistent type imports rule #40

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

Conversation

diegomansua
Copy link
Contributor

@diegomansua diegomansua commented May 24, 2024

Opening this after a comment left by @svt-ivanov in a PR which includes this link.

Here's a link to the documentation for this rule.

Important: I had to use fixStyle: 'inline-type-imports' because the default behaviour clashes with the no-duplicate-imports rule because it creates two imports, one for types and one for non-types:

import type {Foo} from 'foobar';
import {Bar} from 'foobar';

With inline-type-imports it will do this instead:

import {Bar, type Foo} from 'foobar';

However this is supported only in TS from v4.5 so some older projects might have issues with this update.

This also can make imports much longer if a large number of types is imported from the same package.

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.

5 participants