https://github.com/arondight/eslint-plugin-check-json-value
ESLint plugin to check value of JSON file
https://github.com/arondight/eslint-plugin-check-json-value
eslint eslint-plugin eslint-plugin-check-json-value eslintplugin json
Last synced: 4 months ago
JSON representation
ESLint plugin to check value of JSON file
- Host: GitHub
- URL: https://github.com/arondight/eslint-plugin-check-json-value
- Owner: Arondight
- License: mit
- Created: 2022-07-10T06:01:18.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-18T13:12:31.000Z (over 1 year ago)
- Last Synced: 2025-08-09T05:47:58.181Z (11 months ago)
- Topics: eslint, eslint-plugin, eslint-plugin-check-json-value, eslintplugin, json
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-check-json-value
- Size: 562 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-check-json-value
ESLint plugin to check value of JSON file.
## Installation
You'll first need to install [ESLint](https://eslint.org/).
```sh
npm install --save-dev eslint
```
Next, install [eslint-plugin-check-json-value](https://www.npmjs.com/package/eslint-plugin-check-json-value).
```sh
npm install --save-dev eslint-plugin-check-json-value
```
## Usage
Add `check-json-value` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix.
```json
{
"plugins": ["check-json-value"]
}
```
Then configure the rules you want to use under the rules section.
```json
{
"rules": {
"check-json-value/json-lint": [
"error",
{
"lint": true
}
],
"check-json-value/json-value": [
"error",
[
{
"file": "member-.+\\.json",
"path": "gender",
"values": [
{
"type": "string",
"value": "^(fe)?males$"
}
]
},
{
"file": "data/record-201[0-9]\\.json",
"path": "records[{{COUNTER1}}].items[{{COUNTER2]}}",
"values": [
{
"type": "number",
"value": "^\\d{4,6}$"
}
],
"if": [
{
"path": "status",
"values": [
{
"type": "string",
"value": "^need confirm$",
"ignoreCase": true
},
{
"type": "string",
"value": "^unconfirmed$",
"ignoreCase": true
}
]
},
{
"path": "complete",
"values": [
{
"type": "boolean",
"value": true
}
]
}
],
"for": [
{
"replace": "{{COUNTER1}}",
"start": 0,
"end": 10,
"step": 1
},
{
"replace": "{{COUNTER2}}",
"start": 0,
"end": 20,
"step": 10
}
]
}
]
]
}
}
```
See schemas of rules [check-json-value/json-lint](https://github.com/Arondight/eslint-plugin-check-json-value/blob/master/lib/rules/meta/json_lint.js) and [check-json-value/json-value](https://github.com/Arondight/eslint-plugin-check-json-value/blob/master/lib/rules/meta/json_value.js). Also here are [examples of usage in unit tests](https://github.com/Arondight/eslint-plugin-check-json-value/tree/master/tests/lib/rules) for rules.
## LICENSE
[MIT License](https://github.com/Arondight/eslint-plugin-check-json-value/blob/master/LICENSE).