Problem with setting operations property on parserOptions when no operations in .graphql files
See original GitHub issueIssue workflow progress
Progress of the issue based on the Contributor Workflow
- 1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox
Please make sure the graphql-eslint version under
package.json
matches yours.
- 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
We don’t have operations defined inside of .graphql files. They are all defined in .ts and .tsx files. If I set my config as:
overrides: [
{
files: ['*.ts', '*.tsx'],
processor: '@graphql-eslint/graphql',
},
{
files: ['*.graphql'],
extends: ['plugin:@graphql-eslint/operations-recommended', 'plugin:@graphql-eslint/relay'],
parserOptions: {
operations: './src/**/*.{ts,tsx}',
schema: '../api-server/src/schema.graphql',
},
},
],
then I get the following errors in each of the .tsx files
If I remove the operations property from parserOptions, then I get the following error for a number of rules:
Error: Error while loading rule '@graphql-eslint/require-id-when-available': Rule `require-id-when-available` requires `parserOptions.operations` to be set and loaded. See https://bit.ly/graphql-eslint-operations for more info
I’m not sure how to proceed without running into errors or disabling a lot of rules.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Issues · B2o5T/graphql-eslint - GitHub
Reload schema in eslint-server if file with schema was changed ... Problem with setting operations property on parserOptions when no operations in .graphql...
Read more >Add CI job to run GraphQL linter (#344088) · Issues - GitLab
use the output as a setting for graphql-eslint plugin (should be defined on parserOptions.schema property; run the linter. In order to run the ......
Read more >@graphql-eslint/eslint-plugin - npm
Apply this plugin to GraphQL definitions defined in code files. If you are defining GraphQL schema or GraphQL operations in code files, you'll ......
Read more >graphql-eslint - Bountysource
Our graphql systems support an #import directive in graphql files to allow sharing ... Problem with setting operations property on parserOptions when no...
Read more >Handling operation errors - Apollo GraphQL Docs
Apollo Client ignores partial data by default, but you can override this behavior by setting a GraphQL error policy. Network errors. These are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@B2o5T I try it and works fine 🎉 thank you ❤️
I had a legacy
.graphqlconfig
taking precedence over parserOptions that cased similar issues like described in the original post. After adding the following parserOptions all was well: