0.0.8 • Published 4 years ago

@hackcodeboot/eslint-plugin-graphql-schema v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

eslint-plugin-graphql-schema

An ESLint plugin to validate GraphQL schema definitions against a set of rules.

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-graphql-schema:

$ npm install @hackcodeboot/eslint-plugin-graphql-schema --save-dev

Plugging it in

Add graphql-schema to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "graphql-schema"
    ]
}

Overriding and settings rules

Configure the rules you want to use under the rules section. We do recommend that you only use file patterns that include `Schemaand/orschema` as this is the pattern found in Shared Configurations.

{
    "overrides":[
        {
            "files": ["*schema*.graphql", "*Schema*.graphql", "*schema*.gql", "*Schema*.gql"],
            "parser": "eslint-plugin-graphql-schema/parser",
            "rules": {
               "graphql-schema/arguments-have-descriptions": ["off", {"commentDescriptions": false}],
               "graphql-schema/fields-have-descriptions": ["warning", {"commentDescriptions": false}],
               "graphql-schema/types-have-descriptions": ["off", {"commentDescriptions": false}],
               "graphql-schema/fields-have-trailing-commas": ["error", "never"]
            }
        }
    ]
}

Rules

Shared Configurations

Recommended

This is a good mix of warnings and errors.

{
    "extends": [
        "plugin:graphql-schema/recommended"
   ]
}

Mom

This is all about explaining yourself and giving everything a description. Don't worry! It's only a stern warning.

{
    "extends": [
        "plugin:graphql-schema/mom"
   ]
}

Hero

All rules get enabled and stand ready to error. Be the hero your team deserves!

{
    "extends": [
        "plugin:graphql-schema/hero"
   ]
}

Credit

License

eslint-plugin-graphql-schema is licensed under the MIT License.

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago