An ESLint plugin that validates and lints JSON files, catching syntax errors and enforcing standards.
eslint-plugin-json is an ESLint plugin that lints JSON files, catching syntax errors, duplicate keys, and other JSON-specific issues. It integrates JSON validation into ESLint workflows, allowing developers to maintain consistent JSON quality across projects. The plugin uses VSCode's JSON language service for robust parsing and error reporting.
Developers and teams using ESLint who need to validate JSON configuration files, manifests, or data files within their codebases.
It provides a unified linting experience for both JavaScript and JSON, reducing the need for separate tools. The plugin offers configurable rules and supports JSON with comments, making it flexible for various JSON standards.
Lint your JSON files
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Integrates JSON linting into existing ESLint setups, allowing unified validation for JavaScript and JSON files without separate tools, as shown in the flat and legacy config examples.
Uses VSCode's JSON language service for parsing, which provides better error recovery than JSON.parse and catches multiple issues like invalid characters or duplicate keys in one pass.
Offers an 'allowComments' option and pre-configured rules for JSON with comments (JSONC), making it flexible for development configs that use commented JSON.
Provides individual rules for specific JSON problems, such as 'json/duplicate-key' or 'json/trailing-comma', enabling precise linting policies beyond basic syntax checks.
Lacks the ability to automatically fix common JSON errors, a feature mentioned as potentially future work, forcing manual corrections for issues like trailing commas.
Adding JSON linting to ESLint can slow down linting processes, especially for large files, as admitted in the philosophy that it's a hacky solution not ideal for JSON.
Only useful if already using ESLint; teams with other linting tools or no JavaScript codebase would find alternative JSON validators more appropriate, limiting its scope.
Requires understanding both flat and legacy ESLint config formats, which can be confusing during setup or transitions between ESLint versions, as detailed in the README.