eslint-plugin-json-files

    1.3.0 • Public • Published

    eslint-plugin-json-files

    npm version

    ESLint JSON processor and rules

    Installation

    You'll first need to install ESLint:

    $ 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:

    {
        "plugins": [
            "json-files"
        ]
    }

    Then configure the rules you want to use under the rules section.

    {
        "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 ensure repository/directory in package.json
    json-files/no-branch-in-dependencies prevent branches in package.json dependencies
    json-files/require-engines require the engines field in package.json
    json-files/require-license require a license in package.json
    json-files/require-unique-dependency-names prevent duplicate packages in dependencies and devDependencies
    json-files/restrict-ranges restrict the dependency ranges in package.json
    json-files/sort-package-json enforce package.json sorting
    json-files/validate-schema require a valid JSON Schema

    Footnotes

    I wouldn't mind getting this merged into eslint-plugin-node or eslint-plugin-json.

    Install

    npm i eslint-plugin-json-files

    DownloadsWeekly Downloads

    31,762

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    19.9 kB

    Total Files

    13

    Last publish

    Collaborators

    • kellyselden