{"id":19811,"library":"eslint-plugin-json-schema-validator","title":"eslint-plugin-json-schema-validator","description":"ESLint plugin that validates JSON, JSONC, JSON5, YAML, TOML, JavaScript, and Vue custom blocks against JSON Schema. Current stable version is 6.2.0 (released 2025-06-10). Requires ESLint >=9.38.0 and Node.js >=20.19.0 (20.x), >=22.13.0 (22.x), or >=24. Actively maintained with monthly releases. Key differentiator: validates structured data formats using JSON Schema within ESLint flat config, supporting multiple data languages and schema from SchemaStore.","status":"active","version":"6.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/ota-meshi/eslint-plugin-json-schema-validator","tags":["javascript","eslint","eslintplugin","eslint-plugin","validator ","validation","jsonschema","json-schema"],"install":[{"cmd":"npm install eslint-plugin-json-schema-validator","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-json-schema-validator","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-json-schema-validator","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin requires ESLint >=9.38.0 (flat config only).","package":"eslint","optional":false}],"imports":[{"note":"ESM-only since v6.0.0 with Node >=20.19.0. Default import provides the plugin object with configs.","wrong":"const eslintPluginJsonSchemaValidator = require('eslint-plugin-json-schema-validator')","symbol":"default","correct":"import eslintPluginJsonSchemaValidator from 'eslint-plugin-json-schema-validator'"},{"note":"Flat config only since v6.0.0. The flat/ prefix is deprecated but still works as alias.","wrong":"export default [ eslintPluginJsonSchemaValidator.configs.flat.recommended ]","symbol":"configs.recommended","correct":"export default [ ...eslintPluginJsonSchemaValidator.configs.recommended ]"},{"note":"Direct import of rules map for custom config is supported.","wrong":"import { rules } from 'eslint-plugin-json-schema-validator/rules'","symbol":"rules","correct":"import { rules } from 'eslint-plugin-json-schema-validator'"}],"quickstart":{"code":"// eslint.config.js\nimport eslintPluginJsonSchemaValidator from 'eslint-plugin-json-schema-validator';\nexport default [\n  ...eslintPluginJsonSchemaValidator.configs.recommended,\n  {\n    rules: {\n      'json-schema-validator/no-invalid': 'warn'\n    }\n  }\n];\n// Run: npx eslint --ext .json,.yaml,.toml src/","lang":"javascript","description":"ESLint flat config using recommended configuration; validates JSON, YAML, and TOML against JSON Schema."},"warnings":[{"fix":"Update ESLint: npm install eslint@^9.38.0 --save-dev; ensure Node.js >=20.19.0 (20.x) or >=22.13.0 (22.x) or >=24.0.0.","message":"ESLint plugin requires ESLint >=9.38.0 and Node.js >=20.19.0/22.13.0/>=24.0.0","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Migrate from .eslintrc to eslint.config.js using flat config format.","message":"v6.0.0 dropped support for older ESLint versions; requires flat config only (eslint.config.js).","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Convert all require('eslint-plugin-json-schema-validator') to import statements. Ensure package.json has 'type': 'module' or use .mjs extension.","message":"v6.0.0 replaced require() with ESM imports; CommonJS require() will fail.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"If you need to validate JSON Schema in JS files, ensure they are processed by ESLint with appropriate parser settings (e.g., @babel/eslint-parser).","message":"Plugin does not validate .js files by default; only JSON, YAML, TOML, and Vue SFC.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use configs.recommended directly instead of configs['flat/recommended'].","message":"The flat/ prefix in configs (e.g., configs['flat/recommended']) is deprecated in v6.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Ensure custom schema URLs are valid and not blocked by normalization. Use local schema files if normalization causes issues.","message":"SchemaStore URLs are normalized to www.schemastore.org; custom URLs may not be recognized.","severity":"gotcha","affected_versions":">=5.5.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Rename eslint.config.js to eslint.config.mjs or add 'type': 'module' to package.json.","cause":"v6.0.0 is ESM-only, but eslint.config.js is being loaded via CommonJS (require).","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/eslint-plugin-json-schema-validator/dist/index.js from /path/to/eslint.config.js not supported."},{"fix":"Install or update: npm install eslint-plugin-json-schema-validator@latest --save-dev; ensure ESLint >=9.38.0.","cause":"Plugin is not installed or ESLint version <9.38.0 incompatibility with v6.","error":"Error: Failed to load plugin 'json-schema-validator' declared in 'plugins': Cannot find module 'eslint-plugin-json-schema-validator'"},{"fix":"Use 'warn' (string) or 1 (number) correctly: 'json-schema-validator/no-invalid': 'warn' (with quotes).","cause":"Severity must be 0, 1, 2, 'off', 'warn', or 'error'.","error":"Configuration for rule 'json-schema-validator/no-invalid' is invalid: Value 'warn' is not a valid severity level."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}