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

Feature: Group named import/export kinds (type/value) on sort-named-imports/exports #114

Closed
2 tasks done
renato-bohler opened this issue Mar 10, 2024 · 1 comment
Closed
2 tasks done
Labels
enhancement New feature or request

Comments

@renato-bohler
Copy link
Contributor

renato-bohler commented Mar 10, 2024

What rule do you want to change?

sort-named-imports & sort-named-exports

Describe the problem

Hey, first of all, love this plugin!


Currently, there's no way to configure sort-named-imports and sort-named-exports to group inline type import/exports.

Code example

When using this rule to sort named imports alphabetically, we get:

import { A, type B, C, type D} from 'rurouni-kenshin'

This is fine, but IMO we should have an option to group inline type imports before/after value imports to improve readability.

Same goes for named exports.

Additional comments

I've implemented this by adding an option called group-kind with possible values mixed (default, current behavior), values-first, and types-first.

// group-kind: mixed
import { A, type B, C, type D} from 'rurouni-kenshin'

// group-kind: values-first
import { A, C, type B, type D } from 'rurouni-kenshin'

// group-kind: types-first
import { type B, type D, A, C } from 'rurouni-kenshin'

Not sure how #113 will affect it, but I've opened #115 anyway. If we agree that this should be doable on this plugin, I can reimplement it on v3.

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@azat-io
Copy link
Owner

azat-io commented Mar 14, 2024

Released in v2.7.0.

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

No branches or pull requests

2 participants