Prettier plugin to sort class, interface, and type alias members (properties, methods, getters/setters) in a configurable order. Current stable version 0.2.4, compatible with Prettier ^3.0.0. Released regularly with bug fixes and features. Differentiators: supports default `@typescript-eslint/member-ordering` order, optional alphabetical sorting, `keepGettersAndSettersTogether`, and experimental `skipSortForSubclassOf` for React component compatibility. Lightweight, no runtime dependencies beyond Prettier.
npm install prettier-plugin-sort-membersVerified import paths — ran on the pinned version, not inferred.
Install plugin, configure options in Prettier config, and format TypeScript classes to sort members.
Align options with ESLint's member-ordering configuration, e.g., set sortMembersAlphabetically to match ESLint's alphabetical ordering.
Use with caution; prefer alternative patterns if stability is required.
If you rely on getters and setters being separated, explicitly set "keepGettersAndSettersTogether": false.
Set sortMembersAlphabetically to true if you want alphabetical sorting of keys in type/interface literals.
Run npm install --save-dev prettier-plugin-sort-members
Upgrade Prettier to ^3.0.0 and ensure prettier-plugin-sort-members is compatible.
Use Prettier's built-in plugin loading via config file or upgrade to Prettier v3.
Adjust ESLint member-ordering config to match plugin's order, or disable rule if plugin is used.