Skip to content

Type imports do not follow rules from import/orderΒ #2347

Closed
@ImRodry

Description

@ImRodry

I have the import/order rule set up with the following configuration:

		"import/order": ["error", {
			"groups": [	"builtin", "index", "external", "internal", "sibling", "parent", "type"],
			"newlines-between": "always",
			"alphabetize": { "order": "asc", "caseInsensitive": true }
		}],

And I expected the groups rule to be applied to type imports, however this doesn't seem the case and these imports seem to just get sorted alphabetically. Here's an example:

// Sorted type imports by import/order
import type { Command } from "../../lib/imports"
import type { WithId } from "mongodb"
Expected sorting following the order external -> internal
import type { WithId } from "mongodb"
import type { Command } from "../../lib/imports"

As I understand this may be seen as expected behavior for some people, I believe this fix could be introduced as a boolean option for the rule that would come disabled by default.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions