Getting Started
Quickstart
Installation
Install the plugin package with your favourite package manager.
npm i -D @graphql-eslint/eslint-plugin⚠️
Make sure you have graphql dependency in your project.
Configuration
Create a new
configuration object
in your eslint.config.js file to setup @graphql-eslint plugin.
eslint.config.js
import graphqlPlugin from '@graphql-eslint/eslint-plugin'
export default [
// ... other config
{
files: ['**/*.graphql'],
languageOptions: {
parser: graphqlPlugin.parser
},
plugins: {
'@graphql-eslint': graphqlPlugin
}
}
]Usage
Basic
Usage with `.graphql` filesUsage with code files `.js/.jsx`Usage to lint both schema/documentsUsage to lint different schemasProgrammatic usage