Skip to content

Commit 6d9ce44

Browse files
authored
Remove missing operation name (#362)
1 parent b2a98a8 commit 6d9ce44

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

.changeset/clean-doors-move.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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

packages/graphqlsp/src/diagnostics.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,13 @@ const clientDirectives = new Set([
5151
]);
5252

5353
export const SEMANTIC_DIAGNOSTIC_CODE = 52001;
54-
export const MISSING_OPERATION_NAME_CODE = 52002;
5554
export const USING_DEPRECATED_FIELD_CODE = 52004;
5655
export const MISSING_PERSISTED_TYPE_ARG = 520100;
5756
export const MISSING_PERSISTED_CODE_ARG = 520101;
5857
export const MISSING_PERSISTED_DOCUMENT = 520102;
5958
export const MISSMATCH_HASH_TO_DOCUMENT = 520103;
6059
export const ALL_DIAGNOSTICS = [
6160
SEMANTIC_DIAGNOSTIC_CODE,
62-
MISSING_OPERATION_NAME_CODE,
6361
USING_DEPRECATED_FIELD_CODE,
6462
MISSING_FRAGMENT_CODE,
6563
UNUSED_FIELD_CODE,
@@ -493,28 +491,6 @@ const runDiagnostics = (
493491
})
494492
.filter(x => x.start + x.length <= endPosition);
495493

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-
518494
return graphQLDiagnostics;
519495
})
520496
.flat()

0 commit comments

Comments
 (0)