Skip to content

Commit a42ed24

Browse files
committed
feat: graphql codegen
Signed-off-by: Adam Setch <[email protected]>
1 parent e9d6379 commit a42ed24

File tree

7 files changed

+24
-28
lines changed

7 files changed

+24
-28
lines changed

biome.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
"rules": {
3737
"recommended": true,
3838
"a11y": {
39-
"useKeyWithClickEvents": "off",
40-
"useSemanticElements": "off"
39+
"useKeyWithClickEvents": "off"
4140
},
4241
"correctness": {
4342
"noUnusedFunctionParameters": "error",
@@ -51,8 +50,7 @@
5150
}
5251
]
5352
}
54-
},
55-
"useUniqueElementIds": "warn"
53+
}
5654
},
5755
"style": {
5856
"useDefaultSwitchClause": "error",
@@ -69,8 +67,7 @@
6967
"noUselessElse": "error"
7068
},
7169
"suspicious": {
72-
"noConsole": "error",
73-
"noUnknownAtRules": "warn"
70+
"noConsole": "error"
7471
}
7572
}
7673
},
@@ -94,5 +91,8 @@
9491
"parser": {
9592
"allowComments": true
9693
}
94+
},
95+
"files": {
96+
"includes": ["**", "!**/generated/**/*"]
9797
}
9898
}

codegen.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const config: CodegenConfig = {
1515
documentMode: 'string',
1616
},
1717
},
18-
// 'src/renderer/utils/api/graphql/generated/schema.graphql': {
19-
// plugins: ['schema-ast'],
20-
// config: {
21-
// includeDirectives: true,
22-
// },
23-
// },
18+
'src/renderer/utils/api/graphql/generated/schema.graphql': {
19+
plugins: ['schema-ast'],
20+
config: {
21+
includeDirectives: true,
22+
},
23+
},
2424
},
2525
};
2626

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,4 @@
145145
"*": "biome check --fix --no-errors-on-unmatched",
146146
"*.{js,ts,tsx}": "pnpm test --findRelatedTests --passWithNoTests --updateSnapshot"
147147
}
148-
}
148+
}

src/renderer/App.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* biome-ignore-all lint/suspicious/noUnknownAtRules: Tailwind CSS directives */
2+
13
/** Tailwind CSS */
24
@import "tailwindcss";
35

src/renderer/utils/api/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { AxiosPromise } from 'axios';
2-
import { print } from 'graphql/language/printer';
32

43
import type {
54
Account,
@@ -241,7 +240,7 @@ export async function searchDiscussions(
241240
'POST',
242241
notification.account.token,
243242
{
244-
query: print(QUERY_SEARCH_DISCUSSIONS),
243+
query: QUERY_SEARCH_DISCUSSIONS,
245244
variables: {
246245
queryStatement: formatAsGitHubSearchSyntax(
247246
notification.repository.full_name,

src/renderer/utils/api/graphql/discussions.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { graphql } from './generated/gql';
22

3-
const FRAGMENT_AUTHOR = graphql(`
3+
export const FRAGMENT_AUTHOR = graphql(`
44
fragment AuthorFields on Actor {
55
login
66
url
@@ -9,16 +9,14 @@ const FRAGMENT_AUTHOR = graphql(`
99
}
1010
`);
1111

12-
const FRAGMENT_COMMENTS = graphql(`
12+
export const FRAGMENT_COMMENTS = graphql(`
1313
fragment CommentFields on DiscussionComment {
1414
databaseId
1515
createdAt
1616
author {
1717
...AuthorFields
1818
}
1919
}
20-
21-
${FRAGMENT_AUTHOR}
2220
`);
2321

2422
export const QUERY_SEARCH_DISCUSSIONS = graphql(`
@@ -61,7 +59,4 @@ export const QUERY_SEARCH_DISCUSSIONS = graphql(`
6159
}
6260
}
6361
}
64-
65-
${FRAGMENT_AUTHOR}
66-
${FRAGMENT_COMMENTS}
6762
`);

src/renderer/utils/api/graphql/generated/gql.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import * as types from './graphql';
1616
*/
1717
type Documents = {
1818
"\n fragment AuthorFields on Actor {\n login\n url\n avatar_url: avatarUrl\n type: __typename\n }\n": typeof types.AuthorFieldsFragmentDoc,
19-
"\n fragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n }\n\n \n": typeof types.CommentFieldsFragmentDoc,
20-
"\n query fetchDiscussions(\n $queryStatement: String!\n $firstDiscussions: Int\n $lastComments: Int\n $lastReplies: Int\n $firstLabels: Int\n $includeIsAnswered: Boolean!\n ) {\n search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) {\n nodes {\n ... on Discussion {\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n ...CommentFields\n replies(last: $lastReplies) {\n nodes {\n ...CommentFields\n }\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n }\n }\n }\n }\n\n \n \n": typeof types.FetchDiscussionsDocument,
19+
"\n fragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n }\n": typeof types.CommentFieldsFragmentDoc,
20+
"\n query fetchDiscussions(\n $queryStatement: String!\n $firstDiscussions: Int\n $lastComments: Int\n $lastReplies: Int\n $firstLabels: Int\n $includeIsAnswered: Boolean!\n ) {\n search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) {\n nodes {\n ... on Discussion {\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n ...CommentFields\n replies(last: $lastReplies) {\n nodes {\n ...CommentFields\n }\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n }\n }\n }\n }\n": typeof types.FetchDiscussionsDocument,
2121
};
2222
const documents: Documents = {
2323
"\n fragment AuthorFields on Actor {\n login\n url\n avatar_url: avatarUrl\n type: __typename\n }\n": types.AuthorFieldsFragmentDoc,
24-
"\n fragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n }\n\n \n": types.CommentFieldsFragmentDoc,
25-
"\n query fetchDiscussions(\n $queryStatement: String!\n $firstDiscussions: Int\n $lastComments: Int\n $lastReplies: Int\n $firstLabels: Int\n $includeIsAnswered: Boolean!\n ) {\n search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) {\n nodes {\n ... on Discussion {\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n ...CommentFields\n replies(last: $lastReplies) {\n nodes {\n ...CommentFields\n }\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n }\n }\n }\n }\n\n \n \n": types.FetchDiscussionsDocument,
24+
"\n fragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n }\n": types.CommentFieldsFragmentDoc,
25+
"\n query fetchDiscussions(\n $queryStatement: String!\n $firstDiscussions: Int\n $lastComments: Int\n $lastReplies: Int\n $firstLabels: Int\n $includeIsAnswered: Boolean!\n ) {\n search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) {\n nodes {\n ... on Discussion {\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n ...CommentFields\n replies(last: $lastReplies) {\n nodes {\n ...CommentFields\n }\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n }\n }\n }\n }\n": types.FetchDiscussionsDocument,
2626
};
2727

2828
/**
@@ -32,11 +32,11 @@ export function graphql(source: "\n fragment AuthorFields on Actor {\n login
3232
/**
3333
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
3434
*/
35-
export function graphql(source: "\n fragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n }\n\n \n"): typeof import('./graphql').CommentFieldsFragmentDoc;
35+
export function graphql(source: "\n fragment CommentFields on DiscussionComment {\n databaseId\n createdAt\n author {\n ...AuthorFields\n }\n }\n"): typeof import('./graphql').CommentFieldsFragmentDoc;
3636
/**
3737
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
3838
*/
39-
export function graphql(source: "\n query fetchDiscussions(\n $queryStatement: String!\n $firstDiscussions: Int\n $lastComments: Int\n $lastReplies: Int\n $firstLabels: Int\n $includeIsAnswered: Boolean!\n ) {\n search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) {\n nodes {\n ... on Discussion {\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n ...CommentFields\n replies(last: $lastReplies) {\n nodes {\n ...CommentFields\n }\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n }\n }\n }\n }\n\n \n \n"): typeof import('./graphql').FetchDiscussionsDocument;
39+
export function graphql(source: "\n query fetchDiscussions(\n $queryStatement: String!\n $firstDiscussions: Int\n $lastComments: Int\n $lastReplies: Int\n $firstLabels: Int\n $includeIsAnswered: Boolean!\n ) {\n search(query: $queryStatement, type: DISCUSSION, first: $firstDiscussions) {\n nodes {\n ... on Discussion {\n number\n title\n stateReason\n isAnswered @include(if: $includeIsAnswered)\n url\n author {\n ...AuthorFields\n }\n comments(last: $lastComments) {\n totalCount\n nodes {\n ...CommentFields\n replies(last: $lastReplies) {\n nodes {\n ...CommentFields\n }\n }\n }\n }\n labels(first: $firstLabels) {\n nodes {\n name\n }\n }\n }\n }\n }\n }\n"): typeof import('./graphql').FetchDiscussionsDocument;
4040

4141

4242
export function graphql(source: string) {

0 commit comments

Comments
 (0)