question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error "parserOptions.operations need to be set and loaded"

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mcmxcdevcommented, Sep 28, 2021

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.

1reaction
B2o5Tcommented, Aug 12, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found