Skip to content

Repository files navigation

eslint-plugin-json

npm Build codecov Code Climate

Eslint plugin for JSON files

⚠️ If you are using eslint v10 or newer, use eslint-plugin-json v5 or newer.

Installation

Install eslint-plugin-json along eslint:

$ npm install --save-dev eslint eslint-plugin-json
# or
$ yarn add --dev eslint eslint-plugin-json

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-json globally.

Usage

Basic configuration (Flat Config ESLint Format)

The json plugin ship with two recommended config you can use to easily activate it via the extends key. It comes in two flavor: one strict (recommended) and one allowing comments recommended-with-comments.

import json from 'eslint-plugin-json';

export