Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove missing operation name (#362)

authored by

Jovi De Croock and committed by
GitHub
6d9ce44d b2a98a8c

+5 -24
+5
.changeset/clean-doors-move.md
··· 1 + --- 2 + '@0no-co/graphqlsp': minor 3 + --- 4 + 5 + Remove missing operation-name code, with our increased focus on not generating any code this becomes irrelevant
-24
packages/graphqlsp/src/diagnostics.ts
··· 51 51 ]); 52 52 53 53 export const SEMANTIC_DIAGNOSTIC_CODE = 52001; 54 - export const MISSING_OPERATION_NAME_CODE = 52002; 55 54 export const USING_DEPRECATED_FIELD_CODE = 52004; 56 55 export const MISSING_PERSISTED_TYPE_ARG = 520100; 57 56 export const MISSING_PERSISTED_CODE_ARG = 520101; ··· 59 58 export const MISSMATCH_HASH_TO_DOCUMENT = 520103; 60 59 export const ALL_DIAGNOSTICS = [ 61 60 SEMANTIC_DIAGNOSTIC_CODE, 62 - MISSING_OPERATION_NAME_CODE, 63 61 USING_DEPRECATED_FIELD_CODE, 64 62 MISSING_FRAGMENT_CODE, 65 63 UNUSED_FIELD_CODE, ··· 492 490 } 493 491 }) 494 492 .filter(x => x.start + x.length <= endPosition); 495 - 496 - try { 497 - const parsed = parse(text, { noLocation: true }); 498 - 499 - if ( 500 - parsed.definitions.some(x => x.kind === Kind.OPERATION_DEFINITION) 501 - ) { 502 - const op = parsed.definitions.find( 503 - x => x.kind === Kind.OPERATION_DEFINITION 504 - ) as OperationDefinitionNode; 505 - if (!op.name) { 506 - graphQLDiagnostics.push({ 507 - message: 'Operation should contain a name.', 508 - start: node.getStart(), 509 - code: MISSING_OPERATION_NAME_CODE, 510 - length: originalNode.node.getText().length, 511 - range: {} as any, 512 - severity: 2, 513 - } as any); 514 - } 515 - } 516 - } catch (e) {} 517 493 518 494 return graphQLDiagnostics; 519 495 })