{"id":19945,"library":"eslint-plugin-sort","title":"eslint-plugin-sort","description":"Auto-fixable sort rules for ESLint. Current stable version is 4.0.0 (October 2024), released with semantic versioning and a monthly release cadence. Key differentiators include native TypeScript support, recommended configuration, support for both flat and legacy ESLint configs, and rules that sort imports, exports, destructuring, object properties, type properties, string enums, and string unions with auto-fix. Compared to alternatives like eslint-plugin-import/order, it offers a narrower focus on sorting with simpler configuration.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mskelton/eslint-plugin-sort","tags":["javascript","eslint","eslint-plugin","sort","fix","typescript"],"install":[{"cmd":"npm install eslint-plugin-sort","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-sort","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-sort","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to run ESLint plugin","package":"eslint","optional":false}],"imports":[{"note":"ESM default import. CJS require is also supported but not recommended for TypeScript.","wrong":"const sort = require('eslint-plugin-sort');","symbol":"default import","correct":"import sort from 'eslint-plugin-sort'"},{"note":"Using flat config with ESM. The flat/recommended config includes all rules as warnings.","wrong":"","symbol":"flat config","correct":"import sort from 'eslint-plugin-sort'; export default [...sort.configs['flat/recommended']];"},{"note":"Rules are accessed via configs or directly from the plugin object.","wrong":"require('eslint-plugin-sort').rules","symbol":"rules","correct":"import sort from 'eslint-plugin-sort'; sort.configs['flat/recommended'].rules"}],"quickstart":{"code":"import sort from 'eslint-plugin-sort';\n\nexport default [\n  sort.configs['flat/recommended'],\n  {\n    rules: {\n      'sort/imports': ['error', { groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'] }],\n      'sort/export-members': 'warn',\n    },\n  },\n];","lang":"javascript","description":"Setup ESLint flat config with eslint-plugin-sort, enabling recommended rules and customizing import sorting groups."},"warnings":[{"fix":"Upgrade ESLint to >=8.56.0","message":"v4.0.0 drops support for ESLint < 8.56.0","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade ESLint to >=8","message":"v3.0.0 drops support for ESLint < 8","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Upgrade to v2.11.0+ or use legacy config","message":"Flat config requires v2.11.0 or later","severity":"gotcha","affected_versions":"<2.11.0"},{"fix":"Override rule severity to 'error' or 'off' as needed","message":"The recommended config enables rules as warnings by default","severity":"gotcha","affected_versions":"*"},{"fix":"Review migration guide for new default groups","message":"The 'sort/imports' rule's 'groups' option changed in v3; previously used different default groups","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install -D eslint-plugin-sort` and ensure the import is correct","cause":"Missing plugin installation or incorrect import path","error":"Error: Failed to load plugin 'sort': Cannot find module 'eslint-plugin-sort'"},{"fix":"Upgrade ESLint to >=8.56.0","cause":"Outdated ESLint version incompatible with plugin v4","error":"Error: ESLint configuration error: [plugin 'sort'] requires eslint >=8.56.0"},{"fix":"Use spread operator: `export default [...sort.configs['flat/recommended'], ...]`","cause":"Using sort.configs incorrectly in flat config","error":"TypeError: sort.configs is not iterable"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}