{"id":19812,"library":"eslint-plugin-json","title":"eslint-plugin-json","description":"ESLint plugin for linting JSON files. Version 4.0.1 supports ESLint flat config and requires Node >=18. It uses VSCode's JSON parser for linting, replacing JSHint in v1.3.1. Recommended for ensuring valid JSON, catching duplicate keys, trailing commas, and other issues. Supports allowing comments. The plugin ships with recommended configs for both flat and legacy ESLint formats.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/azeemba/eslint-plugin-json","tags":["javascript","eslint","eslintplugin","eslint-plugin","json","eslint-plugin-json"],"install":[{"cmd":"npm install eslint-plugin-json","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-json","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-json","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - plugin requires ESLint to run","package":"eslint","optional":false}],"imports":[{"note":"ESM import for flat config (ESLint v9+). Also works with require in legacy.","symbol":"default","correct":"import json from 'eslint-plugin-json'"},{"note":"Import the plugin object for flat config.","symbol":"json","correct":"import json from 'eslint-plugin-json'"},{"note":"Access recommended config for flat config.","symbol":"configs (recommended)","correct":"json.configs['recommended']"},{"note":"Access legacy recommended config for .eslintrc.","symbol":"configs (recommended-legacy)","correct":"json.configs['recommended-legacy']"}],"quickstart":{"code":"// eslint.config.js (flat config)\nimport json from 'eslint-plugin-json';\n\nexport default [\n  {\n    files: ['**/*.json'],\n    ...json.configs['recommended']\n  }\n];\n// Then run: npx eslint . --ext .json","lang":"javascript","description":"Basic flat config setup to lint all .json files using the recommended config."},"warnings":[{"fix":"Use eslint-plugin-json v4+ and flat config format (eslint.config.js).","message":"ESLint v9+ requires flat config; plugin v4+ needed.","severity":"breaking","affected_versions":">=9"},{"fix":"Define files glob in eslint.config.js instead of --ext .json.","message":"ESLint v9 dropped --ext flag support for some formats; use files in flat config.","severity":"breaking","affected_versions":">=9"},{"fix":"Use individual rules like 'json/undefined' for granular control, or set severity on json/*.","message":"The rule json/* applies all linting rules; configuring individual rules may override.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Migrate to flat config and use recommended config.","message":"Legacy configs (recommended-legacy) are deprecated in favor of flat config.","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Switch to eslint.config.js (flat config).","message":"Use of .eslintrc config format is deprecated for new projects with ESLint v9+.","severity":"deprecated","affected_versions":">=9"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install --save-dev eslint-plugin-json","cause":"Plugin not installed or not in node_modules.","error":"Failed to load plugin 'json': Cannot find module 'eslint-plugin-json'"},{"fix":"Add processor: 'json/json' in flat config or use recommended config.","cause":"Legacy config using individual rules without specifying processor.","error":"ESLint: Error while loading rule 'json/undefined': Rule not found"},{"fix":"This is not a json plugin issue; configure linebreak-style rule elsewhere.","cause":"This rule is from another plugin (e.g., eslint-plugin-linebreak), not this one.","error":"ESLint: Expected linebreaks to be 'LF' but found 'CRLF'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}