Registry / testing / eslint-plugin-json-files

eslint-plugin-json-files

JSON →
library5.1.2jsnpmunverified

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-files
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-JSON
E
eslint-plugin-json-files
testingjavascriptv5.1.2
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 (plugin object)
const jsonFiles = require('eslint-plugin-json-files');
CommonJS require is supported. For ESM, use dynamic import or set package type to module with Node >=20.
processor 'json-files/json'
processor: 'json-files/json'
Processor must be referenced as a string literal in the config.
rules (e.g., 'json-files/sort-package-json')
rules: { 'json-files/sort-package-json': 'error' }
rules: { 'sort-package-json': 'error' }
Rule names must be prefixed with 'json-files/'

Configures eslint-plugin-json-files in flat config with processor and two rules.

// eslint.config.js const jsonFiles = require('eslint-plugin-json-files'); module.exports = [ { plugins: { 'json-files': jsonFiles, }, processor: 'json-files/json', rules: { 'json-files/sort-package-json': 'error', 'json-files/require-license': 'error', }, }, ];
Debug
Known issues
breakingv5 drops support for legacy eslintrc config format; only flat config (eslint.config.js) is supported.
fix
Migrate from .eslintrc to eslint.config.js using the flat config format shown in the quickstart.
affects: >=5.0.0
breakingNode.js >=20.9 required starting from v5. Older Node versions will fail to load the plugin.
fix
Upgrade Node.js to 20.9 or later.
affects: >=5.0.0
gotchaProcessor must be explicitly set to 'json-files/json' for JSON file linting; omitting it results in no linting of JSON files.
fix
Add processor: 'json-files/json' in the flat config object.
affects: >=1.0.0
deprecatedThe rule 'json-files/ensure-repository-directory' is deprecated and will be removed in a future major version.
fix
Remove the rule from config or migrate to alternative validation.
affects: >=4.0.0
gotchaRules only apply to package.json by default; other JSON files need explicit file matching via config.
fix
Add 'files' or 'ignores' in config to target specific JSON files.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Failed to load plugin 'eslint-plugin-json-files'
Plugin not installed or missing peer dependency 'eslint'.
fix
Run 'npm install eslint eslint-plugin-json-files --save-dev'.
Error: Plugin 'eslint-plugin-json-files' uses processor but no processor was set
Processor not configured in flat config.
fix
Add 'processor: 'json-files/json'' to the config object.
Error: Cannot find module 'eslint-plugin-json-files'
CommonJS require failing in ESM-only project.
fix
Use dynamic import: 'import jsonFiles from 'eslint-plugin-json-files';' or set "type": "commonjs".
Rule 'json-files/sort-package-json' is not configured correctly
Rule name missing the 'json-files/' prefix.
fix
Use 'json-files/sort-package-json' instead of 'sort-package-json'.
Upgrade
Version history
5.1.2latest on npm
Audit
Dependencies
eslintrequiredPeer dependency required as the plugin runs within ESLint
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-json-files — npm install eslint-plugin-json-files · libregistry