Registry / testing / eslint-plugin-sort-keys-fix

eslint-plugin-sort-keys-fix

JSON →
library1.1.2jsnpmunverified

ESLint plugin that extends the built-in sort-keys rule with automatic fix capability. Version 1.1.2 is the latest stable release. This plugin sorts object keys alphabetically and provides autofix on save, unlike the core rule which only reports errors. It supports all native sort-keys options except minKeys and works with ESLint's --fix flag. Maintained as a fork with occasional updates, it's a convenient tool for enforcing consistent key ordering without manual effort.

npm install eslint-plugin-sort-keys-fix
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-SORT
E
eslint-plugin-sort-keys-fix
testingjavascriptv1.1.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

Plugin (eslint-plugin-sort-keys-fix)
✓ plugins: ['sort-keys-fix']
✗ rules: { 'sort-keys-fix': 'warn' } without plugins section
Requires both plugin declaration and rule entry.
Rule (sort-keys-fix/sort-keys-fix)
✓ "sort-keys-fix/sort-keys-fix": "warn"
✗ "sort-keys-fix": "warn"
Rule name includes the plugin prefix 'sort-keys-fix/'.
Sort options
✓ { "sort-keys-fix/sort-keys-fix": ["warn", "asc", { "caseSensitive": false }] }
Options match ESLint sort-keys: [severity, order, optionsObject].

Enable the sort-keys-fix rule with autofix in ESLint config. Object keys will be sorted alphabetically.

// .eslintrc.json { "plugins": ["sort-keys-fix"], "rules": { "sort-keys-fix/sort-keys-fix": ["warn", "asc", { "caseSensitive": true, "natural": false }] } } // file.js – will be fixed on save/--fix const obj = { z: 1, a: 2 }; // fixed to { a: 2, z: 1 }
Debug
Known issues
gotchaThe rule only sorts top-level keys, not nested objects by default.
fix
Use ESLint's --fix flag or editor integration to trigger autofix.
affects: >=1.0.0
gotchaminKeys option from ESLint sort-keys is not supported.
fix
Do not use minKeys option; it will be ignored or cause errors.
affects: >=1.0.0
breakingVersion 1.1.0 changed how spread operators are handled: property groups split by spread are now sorted separately.
fix
Update to 1.1.2 or review sorting behavior for objects with spread operators.
affects: >=1.1.0 <1.1.2
Errors
Common errors & fixes
ESLint couldn't find the plugin "sort-keys-fix"
Plugin package not installed or not in node_modules.
fix
npm install eslint-plugin-sort-keys-fix --save-dev
Configuration for rule "sort-keys-fix/sort-keys-fix" is invalid: Value "warn" is the wrong type. Expected array or string.
Rule configuration used without options specified incorrectly.
fix
Use severity string directly: "sort-keys-fix/sort-keys-fix": "warn"
Definition for rule 'sort-keys-fix/sort-keys-fix' was not found.
Plugin not declared in plugins array, or rule name misspelled.
fix
Add 'plugins: ["sort-keys-fix"]' in ESLint config.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required as an ESLint plugin.
Agent activity
8 hits · last 30 days
node
8
Resources
eslint-plugin-sort-keys-fix — npm install eslint-plugin-sort-keys-fix · libregistry