Error "parserOptions.operations need to be set and loaded"
See original GitHub issueDescribe the bug
We want to use e.g. @graphql-eslint/no-unused-fields
rule but it complains and breaks linting:
Error while loading rule '@graphql-eslint/no-unused-fields': Rule 'no-unused-fields' requires 'parserOptions.operations' to be set and loaded.
To my understanding and after reading the explanatory link that comes with the error message, setting operations like "operations": ["./{apps,libs,pages}/**/*.graphql"],
should be fine.
Before, it was actually set as "operations": ["./**/*.graphql"],
but that didn’t help.
To Reproduce
Here is a gist of the eslint config: https://gist.github.com/mhatvan/d3ee11e8f3a3ae19e277b9579ee82e07
Sorry for the big file, config is further below.
Environment:
- OS: Ubuntu 21.04
@graphql-eslint/...
: v2.0.0- NodeJS: v14.17.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
let `require-id-when-available` validate when fragment is ...
Error: You have used a rule which requires GraphQL operations to be loaded. ... Error: Rule '${ruleName}' requires parserOptions.operations to be set.
Read more >graphql-eslint/eslint-plugin "parserOptions.schema" error
Roles that require schema/operation file - failure. ... requires 'parserOptions.schema' to be set and schema to be loaded.
Read more >@graphql-eslint/eslint-plugin - npm
Key Features. Integrates with ESLint core (as a ESTree parser); Works on .graphql files, gql usages and /* GraphQL */ magic comments ...
Read more >graphql-eslint - Bountysource
Problem with setting operations property on parserOptions when no operations in .graphql files ... requires 'parserOptions.operations' to be set and loaded.
Read more >error while loading rule '@typescript-eslint/naming-convention ...
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. // DO NOT SET createDefaultProgram to true to prevent future breakage.
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
Hey @beaucollins, I am not working as a freelancer for the project mentioned above anymore, so can’t help you there, unfortunately. In my case, we only had one schema set, not multiple ones though.
It’s hard to debug without reproduction repo (I used
graphql-eslint
already in monorepo project and I didn’t have any problems), maybe this comment will help you.