Skip to content

Commit f55c2a3

Browse files
1 parent 4f66f3d commit f55c2a3

File tree

6 files changed

+17
-22
lines changed

6 files changed

+17
-22
lines changed

src/language/visitor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const QueryDocumentKeys = {
136136
InputObjectTypeExtension: ['name', 'directives', 'fields'],
137137
};
138138

139-
export const BREAK = {};
139+
export const BREAK = Object.freeze({});
140140

141141
/**
142142
* visit() will walk through an AST using a depth first traversal, calling

src/type/directives.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ export const GraphQLDeprecatedDirective = new GraphQLDirective({
181181
/**
182182
* The full list of specified directives.
183183
*/
184-
export const specifiedDirectives: $ReadOnlyArray<*> = [
184+
export const specifiedDirectives = Object.freeze([
185185
GraphQLIncludeDirective,
186186
GraphQLSkipDirective,
187187
GraphQLDeprecatedDirective,
188-
];
188+
]);
189189

190190
export function isSpecifiedDirective(directive: mixed): boolean %checks {
191191
return (

src/type/introspection.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export const __EnumValue = new GraphQLObjectType({
385385
}),
386386
});
387387

388-
export const TypeKind = {
388+
export const TypeKind = Object.freeze({
389389
SCALAR: 'SCALAR',
390390
OBJECT: 'OBJECT',
391391
INTERFACE: 'INTERFACE',
@@ -394,7 +394,7 @@ export const TypeKind = {
394394
INPUT_OBJECT: 'INPUT_OBJECT',
395395
LIST: 'LIST',
396396
NON_NULL: 'NON_NULL',
397-
};
397+
});
398398

399399
export const __TypeKind = new GraphQLEnumType({
400400
name: '__TypeKind',
@@ -473,7 +473,7 @@ export const TypeNameMetaFieldDef: GraphQLField<*, *> = {
473473
resolve: (source, args, context, { parentType }) => parentType.name,
474474
};
475475

476-
export const introspectionTypes: $ReadOnlyArray<*> = [
476+
export const introspectionTypes = Object.freeze([
477477
__Schema,
478478
__Directive,
479479
__DirectiveLocation,
@@ -482,7 +482,7 @@ export const introspectionTypes: $ReadOnlyArray<*> = [
482482
__InputValue,
483483
__EnumValue,
484484
__TypeKind,
485-
];
485+
]);
486486

487487
export function isIntrospectionType(type: mixed): boolean %checks {
488488
return (

src/type/scalars.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ export const GraphQLID = new GraphQLScalarType({
245245
},
246246
});
247247

248-
export const specifiedScalarTypes: $ReadOnlyArray<*> = [
248+
export const specifiedScalarTypes = Object.freeze([
249249
GraphQLString,
250250
GraphQLInt,
251251
GraphQLFloat,
252252
GraphQLBoolean,
253253
GraphQLID,
254-
];
254+
]);
255255

256256
export function isSpecifiedScalarType(type: mixed): boolean %checks {
257257
return (

src/utilities/findBreakingChanges.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '../type/definition';
2828
import { type GraphQLSchema } from '../type/schema';
2929

30-
export const BreakingChangeType = {
30+
export const BreakingChangeType = Object.freeze({
3131
FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND',
3232
FIELD_REMOVED: 'FIELD_REMOVED',
3333
TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND',
@@ -43,16 +43,16 @@ export const BreakingChangeType = {
4343
DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED',
4444
DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED',
4545
REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED',
46-
};
46+
});
4747

48-
export const DangerousChangeType = {
48+
export const DangerousChangeType = Object.freeze({
4949
ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE',
5050
VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM',
5151
INTERFACE_ADDED_TO_OBJECT: 'INTERFACE_ADDED_TO_OBJECT',
5252
TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION',
5353
OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED',
5454
OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED',
55-
};
55+
});
5656

5757
export type BreakingChange = {
5858
type: $Keys<typeof BreakingChangeType>,

src/validation/specifiedRules.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
* @flow strict
88
*/
99

10-
import {
11-
type ValidationRule,
12-
type SDLValidationRule,
13-
} from './ValidationContext';
14-
1510
// Spec Section: "Executable Definitions"
1611
import { ExecutableDefinitions } from './rules/ExecutableDefinitions';
1712

@@ -102,7 +97,7 @@ import { UniqueInputFieldNames } from './rules/UniqueInputFieldNames';
10297
* The order of the rules in this list has been adjusted to lead to the
10398
* most clear output when encountering multiple validation errors.
10499
*/
105-
export const specifiedRules: $ReadOnlyArray<ValidationRule> = [
100+
export const specifiedRules = Object.freeze([
106101
ExecutableDefinitions,
107102
UniqueOperationNames,
108103
LoneAnonymousOperation,
@@ -129,7 +124,7 @@ export const specifiedRules: $ReadOnlyArray<ValidationRule> = [
129124
VariablesInAllowedPosition,
130125
OverlappingFieldsCanBeMerged,
131126
UniqueInputFieldNames,
132-
];
127+
]);
133128

134129
import { LoneSchemaDefinition } from './rules/LoneSchemaDefinition';
135130
import { UniqueOperationTypes } from './rules/UniqueOperationTypes';
@@ -140,7 +135,7 @@ import { UniqueDirectiveNames } from './rules/UniqueDirectiveNames';
140135
import { PossibleTypeExtensions } from './rules/PossibleTypeExtensions';
141136

142137
// @internal
143-
export const specifiedSDLRules: $ReadOnlyArray<SDLValidationRule> = [
138+
export const specifiedSDLRules = Object.freeze([
144139
LoneSchemaDefinition,
145140
UniqueOperationTypes,
146141
UniqueTypeNames,
@@ -155,4 +150,4 @@ export const specifiedSDLRules: $ReadOnlyArray<SDLValidationRule> = [
155150
UniqueArgumentNames,
156151
UniqueInputFieldNames,
157152
ProvidedRequiredArgumentsOnDirectives,
158-
];
153+
]);

0 commit comments

Comments
 (0)