{"id":13801265,"url":"https://github.com/ota-meshi/eslint-plugin-json-schema-validator","last_synced_at":"2025-04-09T14:14:22.884Z","repository":{"id":37045150,"uuid":"337348523","full_name":"ota-meshi/eslint-plugin-json-schema-validator","owner":"ota-meshi","description":"ESLint plugin that validates data using JSON Schema Validator.","archived":false,"fork":false,"pushed_at":"2024-04-13T14:19:10.000Z","size":1781,"stargazers_count":59,"open_issues_count":7,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-13T22:27:40.055Z","etag":null,"topics":["eslint","eslint-plugin","eslintplugin","json","json-schema","json5","jsonc","toml","validation","validator","yaml"],"latest_commit_sha":null,"homepage":"https://ota-meshi.github.io/eslint-plugin-json-schema-validator/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ota-meshi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":["ota-meshi","JounQin"],"open_collective":"rxts","patreon":"1stG"}},"created_at":"2021-02-09T09:10:25.000Z","updated_at":"2024-04-19T05:23:06.052Z","dependencies_parsed_at":"2023-11-07T14:40:55.237Z","dependency_job_id":"e9f886e8-b42b-46a3-8376-8f747e860d00","html_url":"https://github.com/ota-meshi/eslint-plugin-json-schema-validator","commit_stats":{"total_commits":790,"total_committers":8,"mean_commits":98.75,"dds":0.3367088607594937,"last_synced_commit":"928ea1353a5e72c2661bfb8d6cb1e2089cff4836"},"previous_names":[],"tags_count":314,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Feslint-plugin-json-schema-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Feslint-plugin-json-schema-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Feslint-plugin-json-schema-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ota-meshi%2Feslint-plugin-json-schema-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ota-meshi","download_url":"https://codeload.github.com/ota-meshi/eslint-plugin-json-schema-validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eslint","eslint-plugin","eslintplugin","json","json-schema","json5","jsonc","toml","validation","validator","yaml"],"created_at":"2024-08-04T00:01:21.048Z","updated_at":"2025-04-09T14:14:22.868Z","avatar_url":"https://github.com/ota-meshi.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ota-meshi","https://github.com/sponsors/JounQin","https://opencollective.com/rxts","https://patreon.com/1stG"],"categories":["TypeScript","Plugins"],"sub_categories":["Languages and Environments"],"readme":"# Introduction\n\n[eslint-plugin-json-schema-validator](https://www.npmjs.com/package/eslint-plugin-json-schema-validator) is ESLint plugin that validates data using JSON Schema Validator.\n\n[![NPM license](https://img.shields.io/npm/l/eslint-plugin-json-schema-validator.svg)](https://www.npmjs.com/package/eslint-plugin-json-schema-validator)\n[![NPM version](https://img.shields.io/npm/v/eslint-plugin-json-schema-validator.svg)](https://www.npmjs.com/package/eslint-plugin-json-schema-validator)\n[![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads\u0026colorB=green\u0026suffix=/day\u0026query=$.downloads\u0026uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-json-schema-validator\u0026maxAge=3600)](http://www.npmtrends.com/eslint-plugin-json-schema-validator)\n[![NPM downloads](https://img.shields.io/npm/dw/eslint-plugin-json-schema-validator.svg)](http://www.npmtrends.com/eslint-plugin-json-schema-validator)\n[![NPM downloads](https://img.shields.io/npm/dm/eslint-plugin-json-schema-validator.svg)](http://www.npmtrends.com/eslint-plugin-json-schema-validator)\n[![NPM downloads](https://img.shields.io/npm/dy/eslint-plugin-json-schema-validator.svg)](http://www.npmtrends.com/eslint-plugin-json-schema-validator)\n[![NPM downloads](https://img.shields.io/npm/dt/eslint-plugin-json-schema-validator.svg)](http://www.npmtrends.com/eslint-plugin-json-schema-validator)\n[![Build Status](https://github.com/ota-meshi/eslint-plugin-json-schema-validator/workflows/CI/badge.svg?branch=main)](https://github.com/ota-meshi/eslint-plugin-json-schema-validator/actions?query=workflow%3ACI)\n\n## :name_badge: Features\n\nThis ESLint plugin validates [JSON], [JSONC], [JSON5], [YAML], [TOML], **JavaScript** and [Vue Custom Blocks] with JSON Schema.\n\nYou can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/playground/) that uses [JavaScript](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/playground/#eJxtUMtqwzAQ/JVFvYVIhtKToIf+QH8gysGx17aCveus1kkg5N/rJ02hKyHQaDQ7Ow9TxRa/8w6NNw5TG0mlcOdk9qbgckKzHSw4nBOTTUWDXW6veRvLXFkyYhtpvno4BIK5gkERlmD2v0ij2iefZZOMW2TSKICOpc621sHMH47zaS18nXhQ4F4jU/KwabDmtsPURFdHbYaTi7xK2L4d6kj2f7MytJheLLtGu/ZtlQ+0ywJ1XI4kh/eeRRN8wmMZAe+KVI4eDvDxDsd1MKSr3xhTnYRvCcWDyoAL/Fypc+8/ZLxMy4/Z3HKhl7AAkkosdHriqlpDgWegcZvnD5npj+8=), [JSON](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/playground/#eJxtUF1vgzAM/CtR9lY1RJr6xNt+x9IHPlzIBDazTTsJ8d9LgHaVtiSylDvd2efJVlSDza0/GJAuopovIXRStdAX7lp0sS6U2CO5iOs3N58BzXqCBWbiYI+/SKs6SO59ssk2G1kMICNu/NaCq2BXwXmtzpmPkkY1NGgklNw8PEgL14O0MWuitmOZRdot3NCNTUT3/7A8diAvI2et9t3bbh/w4ANO28RLgh8FrCXYJZc5vZvz8cngNaHTI1vCSqabACdceYSNmp+StfEfEXynm+BgbwXjy74SLcqx0o2my2XfjZkDLs/Od5odhuU=), [YAML](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/playground/#eJxtjkFuhDAMRa9ime0kSKOu2PUCvUDTRQADqYJNHTPTqurdO8CM1EXl1X/f3/7fOKRML3EmbNBTyYlNO/8V54wn7KTfeAWHAe9F2JVuojm6S8ypjyZas7jEu2zglVRFTxBwMltKU9dbxh+ZctsmLzrWj0cB3wJX4Bw8t7IayGJJuDTwSItFN1OZkh+TTWvrk9zDbsnrmNj930nXTOVPMz/ZnKv7+cD0acR9aQIDOHg63whfdtWqXAtpwAZMVwq8X9qtgPSxzeYFvEblgAcvpqmzg8swbBh/fgE9uHsQ) and [TOML](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/playground/#eJxtjjFPxDAMhf9KlK6XdOCmSgyIHYnpBsKQtr7GKImr2GE58d/xcSAY2Pze82e/iz1jhqdYwE7W7w1EEFpbvFDJ9mAXWq/JYIAzVjFvTNXxkqBE9x4zrlGojZUc1i85mRfFqR1MsElk52kcr4y/Mazb4Klt4++rYF9DHYxz5mGmLoZ2Qao8mR+eJLoCnNBvKKnPHmm81XF77htW93+r1jPwn24+ScnD9/lQpUXUI9sjlRLNvRYGvgtWgzifcJWk3jFUhoI6nWNmUKVAhudOAmpK6+rZj0/iJXYT).\n\n\u003c!--DOCS_IGNORE_START--\u003e\n\n## :book: Documentation\n\nSee [documents](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/).\n\n## :cd: Installation\n\n```bash\nnpm install --save-dev eslint eslint-plugin-jsonc eslint-plugin-json-schema-validator\n```\n\n\u003e **Requirements**\n\u003e\n\u003e - ESLint v6.0.0 and above\n\u003e - Node.js v14.18.x, v16.x and above\n\n\u003c!--DOCS_IGNORE_END--\u003e\n\n## :book: Usage\n\n\u003c!--USAGE_SECTION_START--\u003e\n\u003c!--USAGE_GUIDE_START--\u003e\n\n### Configuration\n\n#### New Config (`eslint.config.js`)\n\nUse `eslint.config.js` file to configure rules. See also: \u003chttps://eslint.org/docs/latest/use/configure/configuration-files-new\u003e.\n\nExample **eslint.config.js**:\n\n```js\nimport eslintPluginJsonSchemaValidator from \"eslint-plugin-json-schema-validator\";\nexport default [\n  // add more generic rule sets here, such as:\n  // js.configs.recommended,\n  ...eslintPluginJsonSchemaValidator.configs[\"flat/recommended\"],\n  {\n    rules: {\n      // override/add rules settings here, such as:\n      // 'json-schema-validator/no-invalid': 'warn'\n    },\n  },\n];\n```\n\nThis plugin provides configs:\n\n- `*.configs['flat/base']` ... Configuration to enable correct JSON, YAML and TOML parsing.\n- `*.configs['flat/recommended']` ... Above, plus rule to validate with JSON Schema.\n\n#### Legacy Config (`.eslintrc`)\n\nUse `.eslintrc.*` file to configure rules. See also: \u003chttps://eslint.org/docs/latest/use/configure/\u003e.\n\nExample **.eslintrc.js**:\n\n```js\nmodule.exports = {\n  extends: [\n    // add more generic rulesets here, such as:\n    // 'eslint:recommended',\n    \"plugin:json-schema-validator/recommended\",\n  ],\n  rules: {\n    // override/add rules settings here, such as:\n    // 'json-schema-validator/no-invalid': 'error'\n  },\n};\n```\n\nThis plugin provides configs:\n\n- `plugin:json-schema-validator/base` ... Configuration to enable correct JSON, YAML and TOML parsing.\n- `plugin:json-schema-validator/recommended` ... Above, plus rule to validate with JSON Schema.\n\n### Running ESLint from the command line\n\nIf you want to run `eslint` from the command line, make sure you include the `.json`, `.jsonc`, `.json5`, `.yaml`, `.yml` and `.toml` extension using [the `--ext` option](https://eslint.org/docs/user-guide/configuring#specifying-file-extensions-to-lint) or a glob pattern, because ESLint targets only `.js` files by default.\n\nExamples:\n\n```bash\neslint --ext .js,.json,.jsonc,.json5,.yaml,.yml,.toml src\neslint \"src/**/*.{js,json,jsonc,json5,yaml,yml,toml}\"\n```\n\n## :computer: Editor Integrations\n\n### Visual Studio Code\n\nUse the [dbaeumer.vscode-eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension that Microsoft provides officially.\n\nYou have to configure the `eslint.validate` option of the extension to check `.json`, `.jsonc`, `.json5`, `.yaml`, `.yml` and `.toml` files, because the extension targets only `*.js` or `*.jsx` files by default.\n\nExample **.vscode/settings.json**:\n\n```json\n{\n  \"eslint.validate\": [\n    \"javascript\",\n    \"javascriptreact\",\n    \"json\",\n    \"jsonc\",\n    \"json5\",\n    \"yaml\",\n    \"toml\"\n  ]\n}\n```\n\n\u003c!--USAGE_GUIDE_END--\u003e\n\u003c!--USAGE_SECTION_END--\u003e\n\n## :white_check_mark: Rules\n\n\u003c!--RULES_SECTION_START--\u003e\n\n\u003c!-- The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.   --\u003e\n\nThe rules with the following star :star: are included in the configs.\n\n\u003c!--RULES_TABLE_START--\u003e\n\n### Rules\n\n| Rule ID | Description | Fixable | RECOMMENDED |\n|:--------|:------------|:-------:|:-----------:|\n| [json-schema-validator/no-invalid](https://ota-meshi.github.io/eslint-plugin-json-schema-validator/rules/no-invalid.html) | validate object with JSON Schema. |  | :star: |\n\n\u003c!--RULES_TABLE_END--\u003e\n\u003c!--RULES_SECTION_END--\u003e\n\n\u003c!--DOCS_IGNORE_START--\u003e\n\n\u003c!--ADVANCED_USAGE_GUIDE_START--\u003e\n\n## :zap: Advanced Usage\n\n### Settings\n\nUse `.eslintrc.*` file to configure `settings`. See also: [https://eslint.org/docs/user-guide/configuring/configuration-files#adding-shared-settings](https://eslint.org/docs/user-guide/configuring/configuration-files#adding-shared-settings).\n\nExample **.eslintrc.js**:\n\n```js\nmodule.exports = {\n  settings: {\n    \"json-schema-validator\": {\n      http: {\n        getModulePath: \"\",\n        requestOptions: {},\n      },\n    },\n  },\n};\n```\n\n- `http` ... Settings to resolve schema URLs.\n  - `getModulePath` ... Module path to `GET` the URL. The default implementation is [./src/utils/http-client/get-modules/http.ts](https://github.com/ota-meshi/eslint-plugin-json-schema-validator/blob/main/src/utils/http-client/get-modules/http.ts).\n  - `requestOptions` ... Options used in the module.\n\n#### Example of `http`\n\nExample of using the `request` module for HTTP requests.\n\n**`./path/to/request-get.js`**:\n\n```js\nconst request = require(\"request\");\n\n/**\n * GET Method using request module.\n */\nmodule.exports = function get(url, options) {\n  return new Promise((resolve, reject) =\u003e {\n    request.get(url, options, (error, _res, body) =\u003e {\n      if (error) {\n        reject(error);\n        return;\n      }\n      resolve(body);\n    });\n  });\n};\n```\n\n**.eslintrc.js**:\n\n\u003c!-- eslint-skip --\u003e\n\n```js\nmodule.exports = {\n  settings: {\n    \"json-schema-validator\": {\n      http: {\n        getModulePath: require.resolve(\"./path/to/request-get.js\"),\n        requestOptions: {\n          // Example of proxy settings.\n          proxy: \"http://my.proxy.com:8080/\",\n        },\n      },\n    },\n  },\n};\n```\n\n\u003c!--ADVANCED_USAGE_GUIDE_END--\u003e\n\n## :beers: Contributing\n\nWelcome contributing!\n\nPlease use GitHub's Issues/PRs.\n\n### Development Tools\n\n- `yarn test` runs tests and measures coverage.\n- `yarn update` runs in order to update readme and recommended configuration.\n\n### Working With Rules\n\nThis plugin uses [jsonc-eslint-parser](https://github.com/ota-meshi/jsonc-eslint-parser), [yaml-eslint-parser](https://github.com/ota-meshi/yaml-eslint-parser) and [toml-eslint-parser](https://github.com/ota-meshi/toml-eslint-parser) for the parser.\n\n\u003c!--DOCS_IGNORE_END--\u003e\n\n## :couple: Related Packages\n\n- [eslint-plugin-jsonc](https://github.com/ota-meshi/eslint-plugin-jsonc) ... ESLint plugin for JSON, JSON with comments (JSONC) and JSON5.\n- [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) ... ESLint plugin for YAML.\n- [eslint-plugin-toml](https://github.com/ota-meshi/eslint-plugin-toml) ... ESLint plugin for TOML.\n- [eslint-plugin-vue](https://eslint.vuejs.org/) ... Official ESLint plugin for Vue.js.\n- [jsonc-eslint-parser](https://github.com/ota-meshi/jsonc-eslint-parser) ... JSON, JSONC and JSON5 parser for use with ESLint plugins.\n- [yaml-eslint-parser](https://github.com/ota-meshi/yaml-eslint-parser) ... YAML parser for use with ESLint plugins.\n- [toml-eslint-parser](https://github.com/ota-meshi/toml-eslint-parser) ... TOML parser for use with ESLint plugins.\n- [vue-eslint-parser](https://github.com/vuejs/vue-eslint-parser) ... The ESLint custom parser for `.vue` files.\n\n## :lock: License\n\nSee the [LICENSE](LICENSE) file for license rights and limitations (MIT).\n\n[SchemaStore]: https://github.com/SchemaStore/schemastore\n[JSON]: https://json.org/\n[JSONC]: https://github.com/microsoft/node-jsonc-parser\n[JSON5]: https://json5.org/\n[YAML]: https://yaml.org/\n[TOML]: https://toml.io/\n[Vue Custom Blocks]: https://vue-loader.vuejs.org/guide/custom-blocks.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fota-meshi%2Feslint-plugin-json-schema-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fota-meshi%2Feslint-plugin-json-schema-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fota-meshi%2Feslint-plugin-json-schema-validator/lists"}