Skip to content


eslint-plugin-jsonc uses eslint to lint json, jsonc and json5 (extended JSON with comments & more).

  • To override default configuration, create a .eslintrc-json.json custom configuration file applicable to your project
  • If you have .json files with comments in your project, you may disable jsonlint to avoid false positive errors, by adding the following content in your .mega-linter.yml configuration file
  • If you have your own local .eslintrc.json (or .yaml or .js equivalent) config in your project, you must
    • add JSON_ESLINT_PLUGIN_JSONC_FILE_NAME: .eslintrc.json (or .yaml or .js equivalent) in your .mega-linter.yml config file
    • add overrides property in it

      See code

            "overrides": [
                    "files": [".json"],
                    "extends": [
                    "parser": "jsonc-eslint-parser",
                        "parserOptions": {
                            "jsonSyntax": "JSON"
                    "files": [".jsonc"],
                    "extends": [
                    "parser": "jsonc-eslint-parser",
                        "parserOptions": {
                            "jsonSyntax": "JSONC"
                    "files": ["*.json5"],
                    "extends": [
                    "parser": "jsonc-eslint-parser",
                        "parserOptions": {
                            "jsonSyntax": "JSON5"

eslint-plugin-jsonc documentation

eslint-plugin-jsonc - GitHub

Configuration in Mega-Linter

Variable Description Default value
JSON_ESLINT_PLUGIN_JSONC_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
Ex: (src|lib)
Include every file
Ex: (test|examples)
Exclude no file
JSON_ESLINT_PLUGIN_JSONC_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".json", ".json5", ".jsonc"]
JSON_ESLINT_PLUGIN_JSONC_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
JSON_ESLINT_PLUGIN_JSONC_CONFIG_FILE eslint-plugin-jsonc configuration file name
Use LINTER_DEFAULT to let the linter find it
JSON_ESLINT_PLUGIN_JSONC_RULES_PATH Path where to find linter configuration file Workspace folder, then Mega-Linter default rules
JSON_ESLINT_PLUGIN_JSONC_DISABLE_ERRORS Run linter but consider errors as warnings false

IDE Integration

Use eslint-plugin-jsonc in your favorite IDE to catch errors before Mega-Linter !

IDE Extension Name Install
Visual Studio Code vscode-eslint Visit Web Site

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 83 Docker Image Size (tag) Docker Pulls
ci_light Optimized for CI items (Dockerfile, Jenkinsfile, JSON/YAML schemas,XML 11 Docker Image Size (tag) Docker Pulls
dart Optimized for DART based projects 37 Docker Image Size (tag) Docker Pulls
documentation Mega-Linter for documentation projects 36 Docker Image Size (tag) Docker Pulls
dotnet Optimized for C, C++, C# or VB based projects 42 Docker Image Size (tag) Docker Pulls
go Optimized for GO based projects 38 Docker Image Size (tag) Docker Pulls
java Optimized for JAVA based projects 37 Docker Image Size (tag) Docker Pulls
javascript Optimized for JAVASCRIPT or TYPESCRIPT based projects 45 Docker Image Size (tag) Docker Pulls
php Optimized for PHP based projects 40 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 43 Docker Image Size (tag) Docker Pulls
ruby Optimized for RUBY based projects 37 Docker Image Size (tag) Docker Pulls
rust Optimized for RUST based projects 37 Docker Image Size (tag) Docker Pulls
salesforce Optimized for Salesforce based projects 37 Docker Image Size (tag) Docker Pulls
scala Optimized for SCALA based projects 37 Docker Image Size (tag) Docker Pulls
swift Optimized for SWIFT based projects 37 Docker Image Size (tag) Docker Pulls
terraform Optimized for TERRAFORM based projects 39 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .json, .json5, .jsonc

Example calls

eslint myfile.json
eslint -c .eslintrc-json.json --no-eslintrc --no-ignore myfile.json
eslint -c .eslintrc-json.json --no-eslintrc --no-ignore myfile.json5
eslint -c .eslintrc-json.json --no-eslintrc --no-ignore myfile.jsonc
eslint --fix -c .eslintrc-json.json --no-eslintrc --no-ignore myfile.json

Help content

eslint [options] file.js [file.js] [dir]

Basic configuration:
  --no-eslintrc                   Disable use of configuration from .eslintrc.*
  -c, --config path::String       Use this configuration, overriding .eslintrc.* config options if present
  --env [String]                  Specify environments
  --ext [String]                  Specify JavaScript file extensions
  --global [String]               Define global variables
  --parser String                 Specify the parser to be used
  --parser-options Object         Specify parser options
  --resolve-plugins-relative-to path::String  A folder where plugins should be resolved from, CWD by default

Specifying rules and plugins:
  --rulesdir [path::String]       Use additional rules from this directory
  --plugin [String]               Specify plugins
  --rule Object                   Specify rules

Fixing problems:
  --fix                           Automatically fix problems
  --fix-dry-run                   Automatically fix problems without saving the changes to the file system
  --fix-type Array                Specify the types of fixes to apply (problem, suggestion, layout)

Ignoring files:
  --ignore-path path::String      Specify path of ignore file
  --no-ignore                     Disable use of ignore files and patterns
  --ignore-pattern [String]       Pattern of files to ignore (in addition to those in .eslintignore)

Using stdin:
  --stdin                         Lint code provided on <STDIN> - default: false
  --stdin-filename String         Specify filename to process STDIN as

Handling warnings:
  --quiet                         Report errors only - default: false
  --max-warnings Int              Number of warnings to trigger nonzero exit code - default: -1

  -o, --output-file path::String  Specify file to write report to
  -f, --format String             Use a specific output format - default: stylish
  --color, --no-color             Force enabling/disabling of color

Inline configuration comments:
  --no-inline-config              Prevent comments from changing config or rules
  --report-unused-disable-directives  Adds reported errors for unused eslint-disable directives

  --cache                         Only check changed files - default: false
  --cache-file path::String       Path to the cache file. Deprecated: use --cache-location - default: .eslintcache
  --cache-location path::String   Path to the cache file or directory

  --init                          Run config initialization wizard - default: false
  --env-info                      Output execution environment information - default: false
  --no-error-on-unmatched-pattern  Prevent errors when pattern is unmatched
  --debug                         Output debugging information
  -h, --help                      Show help
  -v, --version                   Output the version number
  --print-config path::String     Print the configuration for the given file

Installation on mega-linter Docker image