graphql-eslint: [Processor] '@graphql-eslint/graphql' was not found

I’m trying to configure the plugin with its processor following the config in the README.md file and I get the following error:

Error: ESLint configuration of processor in '.eslintrc.js#overrides[0]' is invalid: '@graphql-eslint/graphql' was not found.

Here is my config:

  overrides: [
    {
      files: ['*.tsx', '*.ts', '*.jsx', '*.js'],
      processor: '@graphql-eslint/graphql',
    },
    {
      files: ['*.graphql'],
      parser: '@graphql-eslint/eslint-plugin',
      plugins: ['@graphql-eslint'],
      rules: {},
    },
  ],

Any advice would be appreciated 😃

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 12
  • Comments: 30 (5 by maintainers)

Most upvoted comments

This broke for me in v2.5.0. It worked in v2.4.0.

Oops! Something went wrong! :(

ESLint: 8.2.0

Error: ESLint configuration of processor in '.eslintrc.cjs#overrides[5]' is invalid: '@graphql-eslint/graphql' was not found.

I’m using yarn v1 with node_modules, not berry.

GraphQL: 15.7.0 ESLint: 8.2.0 Node.js: 14.18.1


EDIT: Somehow my dependencies in node_modules got installed in a weird way after trying this version which triggered the error above. After downgrading to v2.4.0, I was seeing the same error, which I hadn’t seen before. With a clean node_modules folder and a fresh yarn, the error does not present itself in either v2.4.0 nor v2.5.0.

Thanks @B2o5T. I’m surprised the fix was so simple 😅 .

@JustinTRoss thanks for the reproduction, it’s so much helpful 👍, you can try this version 2.4.1-alpha-7542cbd.0 that is compatible with yarn berry.

Thank you for your response!

I guess I understand I need rules for preferred syntax but it seems rules for incorrect syntax ought to be enabled by default. If not, it would be great to have examples in the README file showing rules to enable to highlight syntax errors.

Thoughts?

You are totally right. I didn’t enable these by default is because most IDEs have GraphQL extensions or GraphiQL extensions (or, graphql-language-server) that would conflict with this validation, leading to a conflict or redundant warnings. I think using these might give you a better experience.

@dotansimha: Thank you for making the plugin compatible with GraphQL v14.7.0, much appreciated 😃

Could you enlighten me about my incorrect field question? is there a rule I have to enable for that? My thinking was that as it violates the schema, I should not have to specify any rule for it to be reported as an error.

The vscode graphql extension points it out as a problem but nothing comes up when I run eslint on the file. Therefore I am thinking the schema is loaded properly but I’m missing something, maybe in the config.

PS: It’s never quite clear whether my configuration is correct or not. It would be great to be able to get a report telling me what schema(s) and rule(s) were found by the tool. Let me know if this information is already available in some way. Thank you!

Seems like the workaround for the ENOTDIR error is to turn off the prettier/prettier rule for graphql files. Not exactly sure if it has any adverse effect.

 overrides: [
    {
      files: ['*.tsx', '*.ts', '*.jsx', '*.js'],
      processor: '@graphql-eslint/graphql',
    },
    {
      files: ['*.graphql'],
      parser: '@graphql-eslint/eslint-plugin',
      plugins: ['@graphql-eslint'],
      rules: {
        'prettier/prettier': 'off', // FIXME: need to turn off prettier for now due to an eslint issue
      },
    },
  ],

Thanks @therealgilles . I’m working on a fix, this was not intended.

It’s GraphQL v14.7.0.