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

add option to put import type statements at the top #202

Open
opensas opened this issue Jan 4, 2023 · 8 comments
Open

add option to put import type statements at the top #202

opensas opened this issue Jan 4, 2023 · 8 comments
Labels
feature request A new feature request v5

Comments

@opensas
Copy link

opensas commented Jan 4, 2023

I have the following imports:

import type { ComponentProps } from 'svelte';
import { writable } from 'svelte/store';

import type Modal from './Modal.svelte';

And I'd like some configuration to sort all the import type statements at the top, like this:

import type { ComponentProps } from 'svelte';
import type Modal from './Modal.svelte';

import { writable } from 'svelte/store';
@opensas opensas added the feature request A new feature request label Jan 4, 2023
@nVitius
Copy link

nVitius commented Jan 10, 2023

Would also be nice if we could configure type imports to be separated by group.

import type { foo } from 'some-lib'
import type { bar } from 'other-lib'

import type { baz } from '@/baz'

import qux from 'some-lib'

import quux from '@/quux'

@ayusharma
Copy link
Collaborator

We had this in #153 and it will be released in the next major version. We released it in v4.1.0 mistakenly and reverted it later on.

If you still like to try then install v4.1.0 and use importOrder: ["<THIRD_PARTY_TS_TYPES>", "^[./]", "<TS_TYPES>^[./]"],

@ayusharma ayusharma added the v5 label Feb 24, 2023
@lanarchyste
Copy link

Possible to re-include types for a 4.x version?
I would like to update prettier to v3

Thanks :)

@jahvi
Copy link

jahvi commented Aug 30, 2023

Would this also work when using the import { type Something } ... syntax?

@50l3r
Copy link

50l3r commented Nov 3, 2023

I join in the wait. I would like to have the type sorting function available using prettier 3.

@mrspartak
Copy link

Any news on this?

@LiuJi-Jim
Copy link

Is this feature ever available on any public releases? I cannot wait to use this nice stuff.

@opensas opensas changed the title add option to put import type statements at the thop add option to put import type statements at the top Mar 21, 2024
@mehdikhody
Copy link

Any updates ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A new feature request v5
Projects
None yet
Development

No branches or pull requests

9 participants