graphql-eslint icon indicating copy to clipboard operation
graphql-eslint copied to clipboard

Ignore "extend schema" in .graphql files

Open gituserjava opened this issue 1 year ago • 7 comments

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?

gituserjava avatar Oct 04 '23 01:10 gituserjava

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

dimaMachina avatar Oct 04 '23 23:10 dimaMachina

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

gituserjava avatar Oct 05 '23 00:10 gituserjava

Until end of year

dimaMachina avatar Oct 05 '23 01:10 dimaMachina

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.

gituserjava avatar Oct 05 '23 03:10 gituserjava

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

dimaMachina avatar Oct 05 '23 13:10 dimaMachina

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?

gunes-sayin avatar Nov 09 '23 12:11 gunes-sayin

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

MarcCoquand avatar Dec 06 '23 19:12 MarcCoquand