-
Notifications
You must be signed in to change notification settings - Fork 109
Description
Describe the bug
If using both the eslint config and graphql config files, and if a rule like '@graphql-eslint/unique-operation-name': 'error' is configured, the following error results:
Error: Rule 'unique-operation-name' requires 'parserOptions.operations' to be set and loaded. See http://bit.ly/graphql-eslint-operations for more info
Workaround: disable the graphQL config by adding skipGraphQLConfig: true and schema to the parserOptions section.
To Reproduce
Some of the eslint rules require parserOptions.operations to bet set to an array of files containing all queries and mutations. Unfortunately, if the project is using both .eslintrc.js and graphql.config.js files, the graphql config file appears to cause parserOptions.operations to be undefined.
Expected behavior
The rules should function normally, without error
Environment:
- OS: macOS
@graphql-eslint/plugin:- NodeJS: v12.22.4
Additional context
Running eslint on just the gql files from the command line via: ./node_modules/.bin/eslint ./src --ext .gql. The behavior within VSCode will show the same error message as a toast style popup.
parserOptions: { // List all Queries & Mutations operations: ['./src/**/*.{gql,graphql}'], // Note - The default (using GraphQLConfig) seems to overwrite parserOptions.options. Workaround by disabling it skipGraphQLConfig: true, schema: '<path to your introspection schema file>.json', },