{"id":25515,"library":"eslint-plugin-json5","title":"eslint-plugin-json5","description":"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.","status":"maintenance","version":"0.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/bayesimpact/eslint-plugin-json5","tags":["javascript","eslint","eslint-plugin","eslintplugin","json5"],"install":[{"cmd":"npm install eslint-plugin-json5","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-json5","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-json5","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for plugin registration and rule processing.","package":"eslint","optional":false}],"imports":[{"note":"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.","wrong":"const json5 = require('eslint-plugin-json5')","symbol":"plugin","correct":"import json5 from 'eslint-plugin-json5'"},{"note":"When using .eslintrc.js, the plugin string should be just 'json5', not the full package name. This is a common ESLint plugin gotcha.","wrong":"module.exports = { plugins: ['eslint-plugin-json5'] };","symbol":"configs","correct":"const json5 = require('eslint-plugin-json5'); module.exports = { plugins: ['json5'], ... };"},{"note":"Named export 'processors' is available. Default export also has .processors property. Prefer named import for clarity.","wrong":"import json5 from 'eslint-plugin-json5'; const processors = json5.processors;","symbol":"processor","correct":"import { processors } from 'eslint-plugin-json5';"}],"quickstart":{"code":"// Ensure ESLint is installed locally\n// Install the plugin\n// npm install --save-dev eslint-plugin-json5\n\n// .eslintrc.json\n{\n  \"plugins\": [\"json5\"],\n  \"extends\": [\"eslint:recommended\"],\n  \"rules\": {\n    \"no-undef\": \"error\",\n    \"quotes\": [\"error\", \"double\"]\n  }\n}\n\n// Run ESLint on JSON5 files\n// npx eslint . --ext json5\n\n// Example .json5 file (config.json5)\n{\n  // comment\n  port: 8080,\n  host: 'localhost',\n  unquoted: true\n}","lang":"javascript","description":"Shows how to install and configure the plugin, then lint a JSON5 file with standard rules like no-undef and quotes."},"warnings":[{"fix":"Use 'eslint . --ext json5' or configure overrides in eslintrc for json5 files.","message":"The plugin only processes JSON5 files; you must specify --ext json5 on the ESLint CLI.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Disable conflicting rules for JSON5 files via overrides or adjust configuration.","message":"All rules apply as if the JSON5 content is a JavaScript object literal, which can cause unintended errors like 'no-undef' on values.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider alternatives like eslint-plugin-jsonc or directly parse JSON5 with your own scripts.","message":"No version has been released since 2020; there is no active maintenance or bug fixes.","severity":"lost","affected_versions":"0.1.4"},{"fix":"Ensure no other processor handles .json files with conflicting transformations.","message":"The plugin adds a preprocessor that transforms the file's extension to .json, which may interfere with other file-type plugins.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'eslint . --ext json5' or add 'overrides' in eslintrc for '*.json5' files.","cause":"ESLint does not automatically lint .json5 files without specifying the extension.","error":"Error: No configuration for .json5 files found. Make sure you add --ext json5 to your command."},{"fix":"Only use this plugin with ESLint; do not try to parse the file as JSON. Ensure the file is treated as .json5 and not .json.","cause":"JSON5 files contain comments, but the plugin expects valid JavaScript object literals (which it gets), but if the file is parsed as JSON by another tool, comments cause errors.","error":"Parsing error: Unexpected token /"},{"fix":"Disable 'no-undef' rule for JSON5 files in overrides, or add dummy globals.","cause":"The processor treats the entire file as a JavaScript object, so keys that are not defined as global or local variables trigger no-undef.","error":"Warning: The 'no-undef' rule found undefined variable 'someKey'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}