https://github.com/maresb/check-json5
checks json files for syntax parsable as json5 (with comments).
https://github.com/maresb/check-json5
Last synced: 9 months ago
JSON representation
checks json files for syntax parsable as json5 (with comments).
- Host: GitHub
- URL: https://github.com/maresb/check-json5
- Owner: maresb
- License: mit
- Created: 2021-12-03T22:31:30.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-04T10:28:15.000Z (over 4 years ago)
- Last Synced: 2025-03-16T11:38:14.368Z (about 1 year ago)
- Language: Python
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# check-json5
## Links
- [GitLab](https://gitlab.com/bmares/check-json5)
- [GitHub](https://github.com/maresb/check-json5)
## Introduction
This is a pre-commit hook which verifies that `.json` files in a repository are valid [JSON5](https://json5.org/). The JSON5 format is similar to JSON, but it permits comments, trailing commas, and more. It is similar to the so-called "JSONC" (JSON with Comments) format, but JSON5 has an actual specification.
This hook is a drop-in replacement for the `check-json` hook from the [official pre-commit-hooks repository](https://pre-commit.com/hooks.html). A file succeeds when it can be loaded by the [json5 library](https://pypi.org/project/json5/). (In contrast, `check-json` uses the built-in [json library](https://docs.python.org/3/library/json.html).)
## Usage
In `.pre-commit-config.yaml` under the `repos:` section, add the following:
```yaml
- repo: https://gitlab.com/bmares/check-json5
rev: v1.0.0
hooks:
- id: check-json5
```
(The original `check-json` hook should probably be removed in case it is already included.)
## Credits
The actual code this hook was written by [@asottile and various contributors to the official pre-commit-hooks repository](https://github.com/pre-commit/pre-commit-hooks/commits/master/pre_commit_hooks/check_json.py). The current author (Ben Mares) replaced the `json` library with `json5` and published it as a separate hook.
## License
This hook is published under the [MIT license](LICENSE). The original pre-commit-hooks collection (from which this hook is derived) is also published under the MIT license, [included here](LICENSE.pre-commit-hooks).