ESLint plugin and processor for linting JSON files, particularly package.json. Current stable version 5.1.2 requires Node >=20.9 and ESLint >=5. It provides 11 rules covering package.json hygiene: sorting, schema validation, dependency restrictions, engines requirements, and no branch dependencies. Unlike generic JSON linters, it focuses on package.json-specific rules. Supports flat config (eslint.config.js) via processor configuration. Released as needed, maintained by Kelly Selden.
npm install eslint-plugin-json-filesVerified import paths — ran on the pinned version, not inferred.
Configures eslint-plugin-json-files in flat config with processor and two rules.
Migrate from .eslintrc to eslint.config.js using the flat config format shown in the quickstart.
Upgrade Node.js to 20.9 or later.
Add processor: 'json-files/json' in the flat config object.
Remove the rule from config or migrate to alternative validation.
Add 'files' or 'ignores' in config to target specific JSON files.
Run 'npm install eslint eslint-plugin-json-files --save-dev'.
Add 'processor: 'json-files/json'' to the config object.
Use dynamic import: 'import jsonFiles from 'eslint-plugin-json-files';' or set "type": "commonjs".
Use 'json-files/sort-package-json' instead of 'sort-package-json'.