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
789 stars 104 forks source link

Feedback for “no-unused-fields” #2139

Closed mashaLutskevich2002 closed 7 months ago

mashaLutskevich2002 commented 7 months ago

What does it mean this rule? I don’t understand (( it means that the schema has a field specified with the type. And in query (in graphql file) this field don’t use?

For example shema.json { "name": "container", "description": null, "isDeprecated": false, "deprecationReason": null, "args": [], "type": { "kind": "NON_NULL", "name": null, "ofType": { "kind": "SCALAR", "name": "Boolean", "ofType": null } } },

And in query (someQuery.graphql) field container dont`s use? Or am I misunderstanding?

mashaLutskevich2002 commented 7 months ago

@dimaMachina This rule don`t work ((

I added to schema.json random field like 'testField', in query I don't ask its. And I don't have an error no-unused-fields

dimaMachina commented 7 months ago

please provide reproduction repo

mashaLutskevich2002 commented 7 months ago

@dimaMachina This is a corporate repository and only used VPN((

Do I understand the logic of the rule correctly? Could I be wrong?

dimaMachina commented 7 months ago

here are docs https://the-guild.dev/graphql/eslint/rules/no-unused-fields here are tests https://github.com/dimaMachina/graphql-eslint/blob/master/packages/plugin/__tests__/no-unused-fields.spec.ts here are snapshots https://github.com/dimaMachina/graphql-eslint/blob/master/packages/plugin/__tests__/__snapshots__/no-unused-fields.spec.md here is original issue https://github.com/dimaMachina/graphql-eslint/issues/9