Enforce sorted named imports.

Sorting named imports promotes a standardized ordering, making it easier for developers to navigate and understand import statements.

This rule ensures that named imports are consistently organized, enhancing the readability and maintainability of the code. By keeping imports sorted, developers can quickly locate necessary modules and maintain a clean code structure.


If you use the sort-imports rule, it is highly recommended to disable it to avoid conflicts.

Try it out


This rule accepts an options object with the following properties:


default: 'alphabetical'

Specifies the sorting method.

  • 'alphabetical' — Sort items alphabetically (e.g., “a” < “b” < “c”).
  • 'natural' — Sort items in a natural order (e.g., “item2” < “item10”).
  • 'line-length' — Sort items by the length of the code line (shorter lines first).


default: 'asc'

Determines whether the sorted items should be in ascending or descending order.

  • 'asc' — Sort items in ascending order (A to Z, 1 to 9).
  • 'desc' — Sort items in descending order (Z to A, 9 to 1).


default: true

Controls whether sorting should be case-sensitive or not.

  • true — Ignore case when sorting alphabetically or naturally (e.g., “A” and “a” are the same).
  • false — Consider case when sorting (e.g., “A” comes before “a”).


default: false

Determines whether to use the import alias as the name for sorting instead of the exported name.

  • true — Use the import alias for sorting.
  • false — Use the exported name for sorting.


default: 'mixed'

Allows you to group named imports by their kind, determining whether value imports should come before or after type imports.

  • mixed — Do not group named imports by their kind; export statements are sorted together regardless of their type.
  • values-first — Group all value imports before type imports.
  • types-first — Group all type imports before value imports.



This rule was introduced in v0.2.0.


Table of Contents