Registry / testing / prettier-plugin-sort-re-exports

prettier-plugin-sort-re-exports

JSON →
library0.1.0jsnpmunverified

Prettier plugin (v0.1.0) that sorts re-export statements by source path, ideal for barrel files. It groups re-exports separated by blank lines or comments and sorts each group independently. Requires Node >=18 and Prettier ^3. Unlike general export sorting plugins, this focuses only on re-exports and preserves group structure. Currently young with potential breaking changes in future versions.

npm install prettier-plugin-sort-re-exports
INSTALL
IMPORT
SIG · PRETTIER-PLUGIN-SO
P
prettier-plugin-sort-re-exports
testingjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Install plugin, configure in .prettierrc, and run Prettier to sort re-exports by source path.

// No import needed – add to .prettierrc // Install: npm install --save-dev prettier-plugin-sort-re-exports // .prettierrc { "plugins": ["prettier-plugin-sort-re-exports"] } // Then run prettier --write on your files // Example barrel file (index.js): export { b } from "./a/bar"; export { c } from "./a/baz"; export { a } from "./a/foo";
Debug
Known issues
gotchaPlugin only sorts re-exports (export … from …), not regular export statements or other code.
fix
Ensure your file contains only re-exports if you expect full sorting.
affects: >=0.1.0
breakingPlugin may reorder groups if blank lines or comments are missing – groups are defined by separating blank lines.
fix
Always separate logically distinct re-export groups with a blank line to prevent merging.
affects: >=0.1.0
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-sort-re-exports'
Plugin not installed or not in node_modules.
fix
npm install --save-dev prettier-plugin-sort-re-exports
Error: Cannot read properties of undefined (reading 'source')
Plugin encounters a non-re-export statement (e.g., export const).
fix
Only include re-export statements (export {…} from '…') in the file.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
prettierrequiredpeer dependency – the plugin runs as a Prettier plugin
Agent activity
6 hits · last 30 days
node
6
Resources
prettier-plugin-sort-re-exports — npm install prettier-plugin-sort-re-exports · libregistry