{"id":19941,"library":"eslint-plugin-sort-export-all","title":"eslint-plugin-sort-export-all","description":"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.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/nirtamir2/eslint-plugin-sort-export-all","tags":["javascript","eslint","eslintplugin","eslint-plugin","import","typescript"],"install":[{"cmd":"npm install eslint-plugin-sort-export-all","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-sort-export-all","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-sort-export-all","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"ESLint plugin, requires ESLint to run","package":"eslint","optional":false}],"imports":[{"note":"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.","wrong":"const sortExportAllConfig = require('eslint-plugin-sort-export-all/config')","symbol":"sortExportAllConfig","correct":"import sortExportAllConfig from 'eslint-plugin-sort-export-all/config'"},{"note":"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.","wrong":"const eslintPluginSortExportAll = require('eslint-plugin-sort-export-all').default","symbol":"eslintPluginSortExportAll","correct":"import eslintPluginSortExportAll from 'eslint-plugin-sort-export-all'"},{"note":"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.","wrong":"'sort-export-all': 'warn'","symbol":"sort-export-all/sort-export-all","correct":"'sort-export-all/sort-export-all': 'warn'"},{"note":"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.","wrong":"plugins: { sortExportAll: eslintPluginSortExportAll }","symbol":"sort-export-all","correct":"plugins: { 'sort-export-all': eslintPluginSortExportAll }"}],"quickstart":{"code":"// eslint.config.js\nimport sortExportAllConfig from 'eslint-plugin-sort-export-all/config';\n\nexport default [\n  sortExportAllConfig(),\n  // additional config...\n];\n\n// Or manually:\nimport eslintPluginSortExportAll from 'eslint-plugin-sort-export-all';\n\nexport default [\n  {\n    plugins: {\n      'sort-export-all': eslintPluginSortExportAll,\n    },\n    rules: {\n      'sort-export-all/sort-export-all': 'warn',\n    },\n  },\n];\n\n// Example file that will be fixed:\n// input: export * from 'c'; export * from 'a';\n// output: export * from 'a'; export * from 'c';","lang":"typescript","description":"Shows ESLint flat config setup using the provided config helper or manual plugin registration, with an example of how the rule sorts star exports."},"warnings":[{"fix":"Upgrade to ESLint 9 flat config and use import syntax. Alternatively, stick with version 1.x if CJS is required.","message":"The plugin uses ESM-only exports and does not provide a CommonJS build. Projects using ESLint with require() in .eslintrc or CJS config will fail.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Set rule to 'warn' or 'error' to enable autofix.","message":"The 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.","severity":"gotcha","affected_versions":"*"},{"fix":"Use other ESLint plugins like eslint-plugin-simple-import-sort for named exports.","message":"The plugin only sorts export * statements. Named exports like export { a, b } or export default are not affected. Users may expect broader sorting.","severity":"gotcha","affected_versions":"*"},{"fix":"Configure ESLint to run this rule's fix separately, or use --fix-type suggestion to control fix order.","message":"Autofix 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.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use dynamic import or switch to ESM: `const sortExportAllConfig = (await import('eslint-plugin-sort-export-all/config')).default;`","cause":"Mistakenly trying to require() the config sub-path in a CommonJS context.","error":"Error: Cannot find module 'eslint-plugin-sort-export-all/config'"},{"fix":"Use rule: 'sort-export-all/sort-export-all': 'warn' or ['warn', { ...options }].","cause":"Rule configured with a severity number or object instead of a string like 'error' or 'warn'.","error":"ESLint: Configuration for rule \"sort-export-all/sort-export-all\" is invalid. Value \"error\" should be string."},{"fix":"Use `const eslintPluginSortExportAll = require('eslint-plugin-sort-export-all').default;` or switch to ESM import.","cause":"Using require('eslint-plugin-sort-export-all') in CJS without .default.","error":"TypeError: eslintPluginSortExportAll is not a function"},{"fix":"Ensure plugins: { 'sort-export-all': eslintPluginSortExportAll } exactly as shown.","cause":"Plugin key in flat config is misspelled or not correctly registered under plugins object.","error":"ESLint couldn't find the plugin \"sort-export-all\"."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}