Autofix-enabled fork of ESLint's built-in sort-keys rule. Current stable version is 2.3.5. It automatically sorts object keys alphabetically with an autofix, unlike the core rule which only warns. It also moves associated comments with properties, supports minKeys threshold, and is intended for ESLint flat config. The package is maintained, with bug fixes released periodically.
npm install eslint-plugin-sort-keysVerified import paths — ran on the pinned version, not inferred.
Shows installation and configuration for autofix sort-keys, including disabling core rule and using plugin rule.
Use 'sort-keys/sort-keys-fix' as the rule name.
Use plugins: { 'sort-keys': require('eslint-plugin-sort-keys') } in eslint.config.js.This fork is still active; however, consider migrating to ESLint's built-in sort-keys if autofix is not critical.
Run ESLint with --fix multiple times or ensure you are using v2.3.5+ which improves comment handling.
Run npm install --save-dev eslint-plugin-sort-keys and verify package.json includes it.
Use 'sort-keys/sort-keys-fix': 'warn' (string severity). Options object is supported but optional.
Use ESLint >=8 and plugin >=2.3.0. For ESLint 9 flat config, ensure flat config usage as shown.