Registry / testing / eslint-plugin-sort-export-all

eslint-plugin-sort-export-all

JSON →
library2.1.0jsnpmunverified

ESLint plugin providing a rule to sort re-export statements (export * from ...) with autofix support. Current stable version is 2.1.0, released with no breaking changes from 2.0.0. It ships TypeScript type definitions and requires ESLint as a peer dependency. Key differentiator: specifically targets sorting of `export *` (also known as star exports) in JavaScript/TypeScript modules, offering automatic sorting via ESLint's fix mechanism. Unlike general import sorting plugins, this one focuses exclusively on re-exports, making it lightweight and purpose-built for monorepos or projects that rely heavily on barrel files.

npm install eslint-plugin-sort-export-all
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-SORT
E
eslint-plugin-sort-export-all
testingjavascriptv2.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sortExportAllConfig
import sortExportAllConfig from 'eslint-plugin-sort-export-all/config'
const sortExportAllConfig = require('eslint-plugin-sort-export-all/config')
The config export is provided as a named default from a separate sub-path. In CommonJS using require() may still work but is untested; prefer ESM syntax as the plugin is ESM-first.
eslintPluginSortExportAll
import eslintPluginSortExportAll from 'eslint-plugin-sort-export-all'
const eslintPluginSortExportAll = require('eslint-plugin-sort-export-all').default
The main plugin export is a default ESM export. Using require() with .default works but is not recommended; use ESM imports for compatibility with ESLint 9 flat config.
sort-export-all/sort-export-all
'sort-export-all/sort-export-all': 'warn'
'sort-export-all': 'warn'
The rule must be referenced with its full name including the plugin namespace prefix. Mistakenly using just the rule name will not trigger the rule.
sort-export-all
plugins: { 'sort-export-all': eslintPluginSortExportAll }
plugins: { sortExportAll: eslintPluginSortExportAll }
The plugin key in the plugins object must be 'sort-export-all' (kebab-case) to match the rule prefix. Using camelCase will cause rule resolution failure.

Shows ESLint flat config setup using the provided config helper or manual plugin registration, with an example of how the rule sorts star exports.

// eslint.config.js import sortExportAllConfig from 'eslint-plugin-sort-export-all/config'; export default [ sortExportAllConfig(), // additional config... ]; // Or manually: import eslintPluginSortExportAll from 'eslint-plugin-sort-export-all'; export default [ { plugins: { 'sort-export-all': eslintPluginSortExportAll, }, rules: { 'sort-export-all/sort-export-all': 'warn', }, }, ]; // Example file that will be fixed: // input: export * from 'c'; export * from 'a'; // output: export * from 'a'; export * from 'c';
Debug
Known issues
breakingThe plugin uses ESM-only exports and does not provide a CommonJS build. Projects using ESLint with require() in .eslintrc or CJS config will fail.
fix
Upgrade to ESLint 9 flat config and use import syntax. Alternatively, stick with version 1.x if CJS is required.
affects: >=2.0.0
gotchaThe rule 'sort-export-all/sort-export-all' must be enabled with severity 'warn' or 'error'. The 'off' severity does nothing and no fix is applied.
fix
Set rule to 'warn' or 'error' to enable autofix.
affects: *
gotchaThe plugin only sorts export * statements. Named exports like export { a, b } or export default are not affected. Users may expect broader sorting.
fix
Use other ESLint plugins like eslint-plugin-simple-import-sort for named exports.
affects: *
gotchaAutofix may conflict with other ESLint rules that also modify import/export statements (e.g., eslint-plugin-import). Run the plugin as the last step or disable conflicting autofixes.
fix
Configure ESLint to run this rule's fix separately, or use --fix-type suggestion to control fix order.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'eslint-plugin-sort-export-all/config'
Mistakenly trying to require() the config sub-path in a CommonJS context.
fix
Use dynamic import or switch to ESM: `const sortExportAllConfig = (await import('eslint-plugin-sort-export-all/config')).default;`
ESLint: Configuration for rule "sort-export-all/sort-export-all" is invalid. Value "error" should be string.
Rule configured with a severity number or object instead of a string like 'error' or 'warn'.
fix
Use rule: 'sort-export-all/sort-export-all': 'warn' or ['warn', { ...options }].
TypeError: eslintPluginSortExportAll is not a function
Using require('eslint-plugin-sort-export-all') in CJS without .default.
fix
Use `const eslintPluginSortExportAll = require('eslint-plugin-sort-export-all').default;` or switch to ESM import.
ESLint couldn't find the plugin "sort-export-all".
Plugin key in flat config is misspelled or not correctly registered under plugins object.
fix
Ensure plugins: { 'sort-export-all': eslintPluginSortExportAll } exactly as shown.
Upgrade
Version history
2.1.0latest on npm
Audit
Dependencies
eslintrequiredESLint plugin, requires ESLint to run
Agent activity
4 hits · last 30 days
node
4
Resources
eslint-plugin-sort-export-all — npm install eslint-plugin-sort-export-all · libregistry