An all-in-one Prettier plugin for sorting imports, package.json keys, and export statements. Version 0.1.0 is current (May 2025), with a rapid release cadence focused on stability and performance. Key differentiators: zero runtime dependencies, TypeScript support, and a modular approach inspired by eslint-plugin-import/order. Supports import attributes (ES2023), type import styling options (separate, inline-first, inline-last, mixed), and respects side-effect imports as chunk boundaries. Ships type definitions. Peer dependency on Prettier >=3.0.0.
npm install prettier-plugin-sortNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates installation, Prettier config activation, default import sorting behavior, and CLI usage.
If your code relies on side-effect imports being sorted, set importOrderSideEffects: "move" (not yet implemented). Otherwise, no action needed.
Upgrade to v0.0.3 or later to preserve import attributes.
Use one of the recognized prefixes for internal modules, or wait for custom pattern support (future release).
Use dynamic import or convert your project to ESM. If using CommonJS, use await import('prettier-plugin-sort').Rename .prettierrc.js to .prettierrc.mjs, or use a JSON config file.
Upgrade Prettier to >=3.0.0: npm i -D prettier@latest
Ensure 'prettier-plugin-sort' is listed in the plugins array of your Prettier config. Do not import it directly unless using programmatic API.
Move the 'plugins' array to the top level of your Prettier config, or use a valid JSON config format.