sort-import-export-specifiers
Sort import and export specifiers by group, name length, and name.
- Rule ID:
tai-kun/sort-import-export-specifiers - Auto-fix: Yes
Sorts specifiers inside braces in the group order type → value → default, then by name length and name inside each group.
Configuration
Add the rule to lint.rules in vite.config.ts to enable it.
"tai-kun/sort-import-export-specifiers": "error",
Examples
Invalid
import { zebra, type Apple, default as base } from "module";
Valid
import { type Apple, zebra, default as base } from "module";
Notes
- Namespace and default imports themselves are excluded.
- Comments outside the specifiers cause the declaration to be skipped.
- Single-line and multiline layouts are preserved.