An ESLint plugin to lint, format, auto-fix, and sort JSON files. Version 2.0.1 is the latest stable release (last updated September 2019). It extends ESLint's capabilities to handle .json and rc files (like .eslintrc, .babelrc) with auto-fix support. Key differentiators include built-in package.json sorting (standard/pro/custom order), ignoring JSON-with-comments files like tsconfig.json, and ignoring package-lock.json by default. Requires ESLint >= 3.2.1. The plugin is in maintenance mode with no recent updates.
npm install eslint-plugin-json-formatNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Install ESLint and the plugin, create a minimal .eslintrc.json configuration, and run ESLint with --fix on JSON files to auto-format and sort.
Use 'json/sort-package-json' instead of 'json/package-json-sort-order'.
Update your configuration to match the new schema (e.g., 'json/sort-package-json': 'standard').
Do not include files that require comments (e.g., .vscode/settings.json) in 'json-with-comments-files', or disable auto-fix for those files.
Add '!.*' to .eslintignore or use 'eslint --ext .js,.json input/.eslintrc.json'.
Consider alternatives like eslint-plugin-json or eslin-plugin-jsonc for newer ESLint versions.
Update ESLint to version >=3.2.1: npm install eslint@latest --save-dev
Use 'json-format/sort-package-json' or 'json-format/*' wildcard, not 'json-format/json-format'. Example: 'rules': { 'json-format/*': 'error' }Run 'npm install eslint-plugin-json-format --save-dev' and ensure your ESLint config file is in the project root.
Add the file pattern to 'json/json-with-comments-files' setting or remove comments from the file.