Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-graphql

Package Overview
Dependencies
Maintainers
4
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-graphql

GraphQL ESLint plugin.

  • 2.1.0-0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
228K
increased by5.49%
Maintainers
4
Weekly downloads
 
Created

What is eslint-plugin-graphql?

eslint-plugin-graphql is an ESLint plugin that provides GraphQL linting rules for your JavaScript and TypeScript projects. It helps ensure that your GraphQL queries, mutations, and subscriptions are syntactically correct and follow best practices.

What are eslint-plugin-graphql's main functionalities?

Linting GraphQL Queries

This feature allows you to lint GraphQL queries within template strings. The configuration specifies the environment as 'literal' and uses a local schema file to validate the queries.

{
  "rules": {
    "graphql/template-strings": [
      "error",
      {
        "env": "literal",
        "schemaJson": require('./schema.json')
      }
    ]
  }
}

Linting GraphQL Files

This feature allows you to lint GraphQL operations in .graphql files. The configuration uses a local schema file to validate the operations and ensures that all operations are named.

{
  "rules": {
    "graphql/named-operations": [
      "error",
      {
        "schemaJson": require('./schema.json')
      }
    ]
  }
}

Custom Validation Rules

This feature allows you to enforce custom validation rules on your GraphQL queries. The example configuration ensures that every query includes the 'id' and '__typename' fields.

{
  "rules": {
    "graphql/required-fields": [
      "error",
      {
        "env": "apollo",
        "schemaJson": require('./schema.json'),
        "requiredFields": ["id", "__typename"]
      }
    ]
  }
}

Other packages similar to eslint-plugin-graphql

FAQs

Package last updated on 15 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc