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

@graphql-eslint/eslint-plugin

Package Overview
Dependencies
Maintainers
2
Versions
561
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-eslint/eslint-plugin

GraphQL plugin for ESLint

  • 4.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
607K
decreased by-0.78%
Maintainers
2
Weekly downloads
 
Created

What is @graphql-eslint/eslint-plugin?

@graphql-eslint/eslint-plugin is an ESLint plugin that provides linting rules for GraphQL schema and operations. It helps developers enforce best practices, catch errors early, and maintain consistency in their GraphQL code.

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

Linting GraphQL Schema

This feature allows you to lint your GraphQL schema files. The example configuration enforces rules to ensure that all type names are known and warns about deprecated fields.

module.exports = {
  'plugins': ['@graphql-eslint'],
  'overrides': [
    {
      'files': ['*.graphql'],
      'parser': '@graphql-eslint/eslint-plugin',
      'rules': {
        '@graphql-eslint/known-type-names': 'error',
        '@graphql-eslint/no-deprecated': 'warn'
      }
    }
  ]
};

Linting GraphQL Operations

This feature allows you to lint GraphQL operations within your JavaScript files. The example configuration enforces rules to ensure that there are no unused fields and that the 'id' field is used when available.

module.exports = {
  'plugins': ['@graphql-eslint'],
  'overrides': [
    {
      'files': ['*.js'],
      'processor': '@graphql-eslint/graphql',
      'rules': {
        '@graphql-eslint/no-unused-fields': 'error',
        '@graphql-eslint/require-id-when-available': 'warn'
      }
    }
  ]
};

Custom Rules

This feature allows you to define custom linting rules for your GraphQL code. The example configuration shows how to set up a custom rule with specific options.

module.exports = {
  'plugins': ['@graphql-eslint'],
  'rules': {
    '@graphql-eslint/custom-rule': [
      'error',
      {
        'ruleOption': 'value'
      }
    ]
  }
};

Other packages similar to @graphql-eslint/eslint-plugin

Keywords

FAQs

Package last updated on 05 Dec 2024

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