Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kellyselden/eslint-plugin-json-files
ESLint JSON processor and rules
https://github.com/kellyselden/eslint-plugin-json-files
Last synced: 18 minutes ago
JSON representation
ESLint JSON processor and rules
- Host: GitHub
- URL: https://github.com/kellyselden/eslint-plugin-json-files
- Owner: kellyselden
- License: mit
- Created: 2019-02-17T10:12:36.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-12-02T18:55:21.000Z (about 2 months ago)
- Last Synced: 2025-01-19T16:02:30.752Z (7 days ago)
- Language: JavaScript
- Size: 799 KB
- Stars: 91
- Watchers: 4
- Forks: 7
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-json-files
[![npm version](https://badge.fury.io/js/eslint-plugin-json-files.svg)](https://badge.fury.io/js/eslint-plugin-json-files)
ESLint JSON processor and rules
## Installation
You'll first need to install [ESLint](http://eslint.org):
```
$ npm i eslint --save-dev
```Next, install `eslint-plugin-json-files`:
```
$ npm install eslint-plugin-json-files --save-dev
```**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-json-files` globally.
## Usage
Add `json-files` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
```json
{
"plugins": [
"json-files"
]
}
```Then configure the rules you want to use under the rules section.
```json
{
"rules": {
"json-files/rule-name": "error"
}
}
```Don't forget to use the extension option.
```
eslint . --ext js,json
```## Supported Rules
| Rule ID | Description |
|:--------|:------------|
| [json-files/ensure-repository-directory](./docs/rules/ensure-repository-directory.md) | ensure repository/directory in package.json |
| [json-files/ensure-volta-extends](./docs/rules/ensure-volta-extends.md) | ensure volta-extends in package.json |
| [json-files/ensure-workspaces](./docs/rules/ensure-workspaces.md) | ensure workspace globs in package.json resolve to directories |
| [json-files/eol-last](./docs/rules/eol-last.md) | require or disallow newline at the end of package.json |
| [json-files/no-branch-in-dependencies](./docs/rules/no-branch-in-dependencies.md) | prevent branches in package.json dependencies |
| [json-files/require-engines](./docs/rules/require-engines.md) | require the engines field in package.json |
| [json-files/require-license](./docs/rules/require-license.md) | require a license in package.json |
| [json-files/require-unique-dependency-names](./docs/rules/require-unique-dependency-names.md) | prevent duplicate packages in dependencies and devDependencies |
| [json-files/restrict-ranges](./docs/rules/restrict-ranges.md) | restrict the dependency ranges in package.json |
| [json-files/sort-package-json](./docs/rules/sort-package-json.md) | enforce package.json sorting |
| [json-files/validate-schema](./docs/rules/validate-schema.md) | require a valid JSON Schema |## Footnotes
I wouldn't mind getting this merged into [eslint-plugin-node](https://github.com/mysticatea/eslint-plugin-node) or [eslint-plugin-json](https://github.com/azeemba/eslint-plugin-json).