dimaMachina / graphql-eslint

ESLint parser, plugin and set rules for GraphQL (for schema and operations). Easily customizable with custom rules. Integrates with IDEs and modern GraphQL tools.
https://the-guild.dev/graphql/eslint
MIT License
795 stars 103 forks source link

Ignore "extend schema" in .graphql files #1910

Open gituserjava opened 1 year ago

gituserjava commented 1 year ago

We use below extend line in our .graphql file for federation and we get below error.

Code snippet:

extend schema @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key"])

type Query {
     myQuery: String
}

Error: 0:0 error Parsing error: [graphql-eslint] Error while loading schema: Directive "@link" may not be used on SCHEMA

Could you please advise on how this issue can be bypassed during graph ql eslint process?

dimaMachina commented 1 year ago

this issue will be fixed after adding federation support https://github.com/B2o5T/graphql-eslint/issues/1824

gituserjava commented 1 year ago

Ok thank you @B2o5T, is there a tentative plan when this will be available?

dimaMachina commented 1 year ago

Until end of year

gituserjava commented 1 year ago

Meanwhile is there a work around? I tried # eslint-disable-next-line and # eslint-ignore and both are not recognized by the library for .graphql files. Please advise.

dimaMachina commented 1 year ago

They should works fine https://github.com/B2o5T/graphql-eslint/blob/master/packages/plugin/__tests__/eslint-directives.spec.ts

gunes-sayin commented 11 months ago

The directives work fine with files without parsing errors (extend in this case). But, they don't work with files that have extend on top. Is there a work around to ignore this part from parsing, until this feature is implemented?

MarcCoquand commented 10 months ago

Hi! Since this is reported as a parsing error, eslint directives are ignored. Is there any workaround?