Registry / testing / eslint-plugin-json5

eslint-plugin-json5

JSON →
library0.1.4jsnpmunverified

An ESLint plugin providing a preprocessor to lint JSON5 files using standard ESLint rules for JavaScript objects. The plugin works by treating JSON5 files as JavaScript object literals, allowing all standard ESLint rules (e.g., no-undef, quotes) to apply. Current stable version is 0.1.4, with no major updates since 2020. It supports ESLint 3-8 via broad peer dependency range. Key differentiator: avoids writing separate JSON5-specific rules by reusing existing ESLint infrastructure. No TypeScript support, no monorepo integration, no file watching improvements. Last released May 2020.

testing
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Plugin is a default export. CommonJS require works but may not be detected by some bundlers. Since the plugin ships a single default export, named import fails.

import json5 from 'eslint-plugin-json5'

When using .eslintrc.js, the plugin string should be just 'json5', not the full package name. This is a common ESLint plugin gotcha.

const json5 = require('eslint-plugin-json5'); module.exports = { plugins: ['json5'], ... };

Named export 'processors' is available. Default export also has .processors property. Prefer named import for clarity.

import { processors } from 'eslint-plugin-json5';

Shows how to install and configure the plugin, then lint a JSON5 file with standard rules like no-undef and quotes.

// Ensure ESLint is installed locally // Install the plugin // npm install --save-dev eslint-plugin-json5 // .eslintrc.json { "plugins": ["json5"], "extends": ["eslint:recommended"], "rules": { "no-undef": "error", "quotes": ["error", "double"] } } // Run ESLint on JSON5 files // npx eslint . --ext json5 // Example .json5 file (config.json5) { // comment port: 8080, host: 'localhost', unquoted: true }
Debug
Known footguns
gotchaThe plugin only processes JSON5 files; you must specify --ext json5 on the ESLint CLI.
gotchaAll rules apply as if the JSON5 content is a JavaScript object literal, which can cause unintended errors like 'no-undef' on values.
lostNo version has been released since 2020; there is no active maintenance or bug fixes.
gotchaThe plugin adds a preprocessor that transforms the file's extension to .json, which may interfere with other file-type plugins.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
3
ahrefsbot
3
claudebot
3
Resources