Registry / testing / eslint-plugin-sort

eslint-plugin-sort

JSON →
library4.0.0jsnpmunverified

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.

npm install eslint-plugin-sort
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-SORT
E
eslint-plugin-sort
testingjavascriptv4.0.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.

default import
import sort from 'eslint-plugin-sort'
const sort = require('eslint-plugin-sort');
ESM default import. CJS require is also supported but not recommended for TypeScript.
flat config
import sort from 'eslint-plugin-sort'; export default [...sort.configs['flat/recommended']];
Using flat config with ESM. The flat/recommended config includes all rules as warnings.
rules
import sort from 'eslint-plugin-sort'; sort.configs['flat/recommended'].rules
require('eslint-plugin-sort').rules
Rules are accessed via configs or directly from the plugin object.

Setup ESLint flat config with eslint-plugin-sort, enabling recommended rules and customizing import sorting groups.

import sort from 'eslint-plugin-sort'; export default [ sort.configs['flat/recommended'], { rules: { 'sort/imports': ['error', { groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'] }], 'sort/export-members': 'warn', }, }, ];
Debug
Known issues
breakingv4.0.0 drops support for ESLint < 8.56.0
fix
Upgrade ESLint to >=8.56.0
affects: >=4.0.0
breakingv3.0.0 drops support for ESLint < 8
fix
Upgrade ESLint to >=8
affects: >=3.0.0 <4.0.0
gotchaFlat config requires v2.11.0 or later
fix
Upgrade to v2.11.0+ or use legacy config
affects: <2.11.0
gotchaThe recommended config enables rules as warnings by default
fix
Override rule severity to 'error' or 'off' as needed
affects: *
deprecatedThe 'sort/imports' rule's 'groups' option changed in v3; previously used different default groups
fix
Review migration guide for new default groups
affects: >=3.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'sort': Cannot find module 'eslint-plugin-sort'
Missing plugin installation or incorrect import path
fix
Run `npm install -D eslint-plugin-sort` and ensure the import is correct
Error: ESLint configuration error: [plugin 'sort'] requires eslint >=8.56.0
Outdated ESLint version incompatible with plugin v4
fix
Upgrade ESLint to >=8.56.0
TypeError: sort.configs is not iterable
Using sort.configs incorrectly in flat config
fix
Use spread operator: `export default [...sort.configs['flat/recommended'], ...]`
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required to run ESLint plugin
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
eslint-plugin-sort — npm install eslint-plugin-sort · libregistry