JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2773947
  • Score
    100M100P100Q216429F
  • License MIT

JSON, JSONC and JSON5 parser for use with ESLint plugins

Package Exports

  • jsonc-eslint-parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jsonc-eslint-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

jsonc-eslint-parser

πŸ“› Introduction

JSON, JSONC and JSON5 parser for use with ESLint plugins.

This parser allows us to lint JSON, JSONC and JSON5 files. This parser and the rules of eslint-plugin-jsonc would catch some of the mistakes and code style violations.

See eslint-plugin-jsonc for details.

πŸ’Ώ Installation

npm i --save-dev jsonc-eslint-parser

πŸ“– Usage

In your ESLint configuration file, set the overrides > parser property:

{
  // ...
  // Add the following settings.
  "overrides": [
    {
      "files": ["*.json", "*.json5"], // Specify the extension or pattern you want to parse as JSON.
      "parser": "jsonc-eslint-parser", // Set this parser.
    },
  ],
}

βš™οΈ Configuration

The following additional configuration options are available by specifying them in parserOptions in your ESLint configuration file.

{
  // ...
  "overrides": [
    {
      "files": ["*.json", "*.json5"],
      "parser": "jsonc-eslint-parser",
      // Additional configuration options
      "parserOptions": {
        "jsonSyntax": "JSON5"
      }
    },
  ],
}

parserOptions.jsonSyntax

Set to "JSON", "JSONC" or "JSON5". Select the JSON syntax you are using.
If not specified, all syntaxes that express static values ​​are accepted. For example, template literals without interpolation.

Note : Recommended to loosen the syntax checking by the parser and use check rules of eslint-plugin-jsonc to automatically fix it.

πŸ”’ License

See the LICENSE file for license rights and limitations (MIT).