azat-io / eslint-plugin-perfectionist

🦄 ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
https://eslint-plugin-perfectionist.azat.io
MIT License
1.62k stars 28 forks source link

feat: adds `group-kind` option on `sort-named-imports` and `sort-named-exports` #115

Closed renato-bohler closed 2 months ago

renato-bohler commented 2 months ago

Description

This PR adds the group-kind option to sort-named-imports and sort-named-exports rules, solving https://github.com/azat-io/eslint-plugin-perfectionist/issues/114

This allows users to group inline named type imports before or after value named imports.

Additional context

This option has three possible values: mixed, values-first, and types-first.

// group-kind: mixed (default, current behavior)
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'

What is the purpose of this pull request?

Before submitting the PR, please make sure you do the following

renato-bohler commented 2 months ago

Unsure how https://github.com/azat-io/eslint-plugin-perfectionist/pull/113 would impact this, but I'd be happy to refactor the implementation if we think the idea is good.

azat-io commented 2 months ago

LGTM. Good idea.

Could you fix ESLint issues? It may also be worth adding information about it to the sorting-named-imports.md.

renato-bohler commented 2 months ago

Will do later this week!

renato-bohler commented 2 months ago

Done!

azat-io commented 2 months ago

Released in v2.7.0.