Skip to content

Commit 98a8b48

Browse files
committed
fix typing generation
1 parent 56c498b commit 98a8b48

File tree

4 files changed

+114
-18
lines changed

4 files changed

+114
-18
lines changed

packages/graphql-eslint-rules/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
"@types/lodash.camelcase": "^4.3.6",
2222
"@types/lodash.kebabcase": "^4.1.6",
2323
"graphql": "^15.0.0",
24+
"json-schema-to-ts": "2.9.1",
2425
"lodash.camelcase": "^4.3.0",
2526
"lodash.kebabcase": "^4.1.1",
2627
"monorepo-scripts": "*"
2728
},
2829
"peerDependencies": {
2930
"graphql": "^15.0.0",
30-
"lodash.kebabcase": "^4.1.1",
31-
"lodash.camelcase": "^4.3.0"
31+
"lodash.camelcase": "^4.3.0",
32+
"lodash.kebabcase": "^4.1.1"
3233
},
3334
"publishConfig": {
3435
"main": "./lib/index",

packages/graphql-eslint-rules/tsconfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"rootDir": "src",
77
"outDir": "lib"
88
},
9-
"include": ["src"],
9+
"include": [
10+
"src",
11+
"./types/kind-override.d.ts"
12+
],
1013
"references": []
1114
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
export * from "graphql";
2+
3+
declare module "graphql" {
4+
/**
5+
* Replaces const Kind with enum Kind to allow successful type build
6+
*/
7+
export enum Kind {
8+
// Name
9+
NAME = "Name",
10+
11+
// Document
12+
DOCUMENT = "Document",
13+
OPERATION_DEFINITION = "OperationDefinition",
14+
VARIABLE_DEFINITION = "VariableDefinition",
15+
SELECTION_SET = "SelectionSet",
16+
FIELD = "Field",
17+
ARGUMENT = "Argument",
18+
19+
// Fragments
20+
FRAGMENT_SPREAD = "FragmentSpread",
21+
INLINE_FRAGMENT = "InlineFragment",
22+
FRAGMENT_DEFINITION = "FragmentDefinition",
23+
24+
// Values
25+
VARIABLE = "Variable",
26+
INT = "IntValue",
27+
FLOAT = "FloatValue",
28+
STRING = "StringValue",
29+
BOOLEAN = "BooleanValue",
30+
NULL = "NullValue",
31+
ENUM = "EnumValue",
32+
LIST = "ListValue",
33+
OBJECT = "ObjectValue",
34+
OBJECT_FIELD = "ObjectField",
35+
36+
// Directives
37+
DIRECTIVE = "Directive",
38+
39+
// Types
40+
NAMED_TYPE = "NamedType",
41+
LIST_TYPE = "ListType",
42+
NON_NULL_TYPE = "NonNullType",
43+
44+
// Type System Definitions
45+
SCHEMA_DEFINITION = "SchemaDefinition",
46+
OPERATION_TYPE_DEFINITION = "OperationTypeDefinition",
47+
48+
// Type Definitions
49+
SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition",
50+
OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition",
51+
FIELD_DEFINITION = "FieldDefinition",
52+
INPUT_VALUE_DEFINITION = "InputValueDefinition",
53+
INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition",
54+
UNION_TYPE_DEFINITION = "UnionTypeDefinition",
55+
ENUM_TYPE_DEFINITION = "EnumTypeDefinition",
56+
ENUM_VALUE_DEFINITION = "EnumValueDefinition",
57+
INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition",
58+
59+
// Directive Definitions
60+
DIRECTIVE_DEFINITION = "DirectiveDefinition",
61+
62+
// Type System Extensions
63+
SCHEMA_EXTENSION = "SchemaExtension",
64+
65+
// Type Extensions
66+
SCALAR_TYPE_EXTENSION = "ScalarTypeExtension",
67+
OBJECT_TYPE_EXTENSION = "ObjectTypeExtension",
68+
INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension",
69+
UNION_TYPE_EXTENSION = "UnionTypeExtension",
70+
ENUM_TYPE_EXTENSION = "EnumTypeExtension",
71+
INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension",
72+
}
73+
}

yarn.lock

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5719,11 +5719,11 @@ create-require@^1.1.0:
57195719
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
57205720

57215721
[email protected], cross-fetch@^3.0.4, cross-fetch@^3.0.6, cross-fetch@^3.1.4, cross-fetch@^3.1.5:
5722-
version "3.1.5"
5723-
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
5724-
integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
5722+
version "3.1.8"
5723+
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82"
5724+
integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==
57255725
dependencies:
5726-
node-fetch "2.6.7"
5726+
node-fetch "^2.6.12"
57275727

57285728
cross-spawn@^6.0.0, cross-spawn@^6.0.5:
57295729
version "6.0.5"
@@ -7527,10 +7527,10 @@ graphql-ws@^5.4.1:
75277527
resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.5.0.tgz#79f10248d23d104369eaef93acb9f887276a2c42"
75287528
integrity sha512-WQepPMGQQoqS2VsrI2I3RMLCVz3CW4/6ZqGV6ABDOwH4R62DzjxwMlwZbj6vhSI/7IM3/C911yITwgs77iO/hw==
75297529

7530-
graphql@*, graphql@^15.0.0, graphql@^15.6.0, graphql@^15.6.1:
7531-
version "15.8.0"
7532-
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38"
7533-
integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==
7530+
graphql@*:
7531+
version "16.8.2"
7532+
resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.2.tgz#54771c7ff195da913f5e70af8044a026d32eca2a"
7533+
integrity sha512-cvVIBILwuoSyD54U4cF/UXDh5yAobhNV/tPygI4lZhgOIJQE/WLWC4waBRb4I6bDVYb3OVx3lfHbaQOEoUD5sg==
75347534

75357535
75367536
version "16.8.1"
@@ -7544,6 +7544,11 @@ graphql@^14.5.3:
75447544
dependencies:
75457545
iterall "^1.2.2"
75467546

7547+
graphql@^15.0.0, graphql@^15.6.0, graphql@^15.6.1:
7548+
version "15.8.0"
7549+
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.8.0.tgz#33410e96b012fa3bdb1091cc99a94769db212b38"
7550+
integrity sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==
7551+
75477552
handle-thing@^2.0.0:
75487553
version "2.0.1"
75497554
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e"
@@ -9013,6 +9018,15 @@ json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1:
90139018
resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d"
90149019
integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==
90159020

9021+
9022+
version "2.9.1"
9023+
resolved "https://registry.yarnpkg.com/json-schema-to-ts/-/json-schema-to-ts-2.9.1.tgz#0e055b787587477abdb7e880c874efad3dba7779"
9024+
integrity sha512-8MNpRGERlCUWYeJwsWkMrJ0MWzBz49dfqpG+n9viiIlP4othaahbiaNQZuBzmPxRLUhOv1QJMCzW5WE8nHFGIQ==
9025+
dependencies:
9026+
"@babel/runtime" "^7.18.3"
9027+
"@types/json-schema" "^7.0.9"
9028+
ts-algebra "^1.2.0"
9029+
90169030
json-schema-traverse@^0.4.1:
90179031
version "0.4.1"
90189032
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
@@ -9810,9 +9824,9 @@ minimatch@^5.1.0:
98109824
brace-expansion "^2.0.1"
98119825

98129826
[email protected], minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
9813-
version "1.2.7"
9814-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
9815-
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
9827+
version "1.2.8"
9828+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
9829+
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
98169830

98179831
minipass@^3.0.0:
98189832
version "3.1.5"
@@ -9968,10 +9982,10 @@ node-emoji@^1.10.0:
99689982
dependencies:
99699983
lodash.toarray "^4.4.0"
99709984

9971-
[email protected].7, node-fetch@^2.6.1, node-fetch@^2.6.5, node-fetch@^2.6.7:
9972-
version "2.6.7"
9973-
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
9974-
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
9985+
node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.5, node-fetch@^2.6.7:
9986+
version "2.7.0"
9987+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
9988+
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
99759989
dependencies:
99769990
whatwg-url "^5.0.0"
99779991

@@ -12332,6 +12346,11 @@ trim@^1.0.1:
1233212346
resolved "https://registry.yarnpkg.com/trim/-/trim-1.0.1.tgz#68e78f6178ccab9687a610752f4f5e5a7022ee8c"
1233312347
integrity sha512-3JVP2YVqITUisXblCDq/Bi4P9457G/sdEamInkyvCsjbTcXLXIiG7XCb4kGMFWh6JGXesS3TKxOPtrncN/xe8w==
1233412348

12349+
ts-algebra@^1.2.0:
12350+
version "1.2.2"
12351+
resolved "https://registry.yarnpkg.com/ts-algebra/-/ts-algebra-1.2.2.tgz#b75d301c28cd4126cd344760a47b43e48e2872e0"
12352+
integrity sha512-kloPhf1hq3JbCPOTYoOWDKxebWjNb2o/LKnNfkWhxVVisFFmMJPPdJeGoGmM+iRLyoXAR61e08Pb+vUXINg8aA==
12353+
1233512354
ts-expect@^1.3.0:
1233612355
version "1.3.0"
1233712356
resolved "https://registry.yarnpkg.com/ts-expect/-/ts-expect-1.3.0.tgz#3f8d3966e0e22b5e2bb88337eb99db6816a4c1cf"

0 commit comments

Comments
 (0)