1. jsonc-eslint-parser
JSON, JSONC and JSON5 parser for use with ESLint plugins
jsonc-eslint-parser
Package: jsonc-eslint-parser
Created by: ota-meshi
Last modified: Tue, 24 Oct 2023 05:53:10 GMT
Version: 2.4.0
License: MIT
Downloads: 6,801,314
Repository: https://github.com/ota-meshi/jsonc-eslint-parser

Install

npm install jsonc-eslint-parser
yarn add jsonc-eslint-parser

jsonc-eslint-parser

NPM license
NPM version
NPM downloads
NPM downloads
Build Status
Coverage Status

:name_badge: 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.

:cd: Installation

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

:book: 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.
    },
  ],
}

:gear: 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.

Usage for Custom Rules / Plugins

:traffic_light: Semantic Versioning Policy

jsonc-eslint-parser follows Semantic Versioning.

:lock: License

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

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code