Skip to content
tai-kun's Vite+ Lint Plugins
Esc
↑↓navigate↵open⌘Jpreview
On this page

sort-type-members

Sort type literal members by name length and then by name.

  • Rule ID: tai-kun/sort-type-members
  • Auto-fix: Yes

Sorts members of type literals by name length, then alphabetically when lengths match. interface declarations are excluded.

Configuration

Add the rule to lint.rules in vite.config.ts to enable it.

"tai-kun/sort-type-members": "error",

Examples

Invalid

type Options = {
  zebra: string;
  a: number;
};

Valid

type Options = {
  a: number;
  zebra: string;
};

Notes

  • Index, call, and construct signatures act as barriers and are not reordered.
  • Blank-line groups and attached comments are preserved.
  • Groups containing duplicate method names (overloads) are skipped.
  • interface declarations are excluded.

Was this page helpful?