From 5b4b19360274d6bc838bf5c358aa9acc0b232b87 Mon Sep 17 00:00:00 2001 From: Natalia Tepluhina <ntepluhina@gitlab.com> Date: Thu, 21 Jul 2022 12:08:14 +0000 Subject: [PATCH] Add more rules to GraphQL ESLint rule set - https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92775 --- .eslintrc.yml | 3 ++ .../editor/graphql/typedefs.graphql | 14 ++++++-- .../queries/environment_app.query.graphql | 1 - .../fragments/blobviewer.fragment.graphql | 7 ---- .../fragments/iteration.fragment.graphql | 4 --- .../mutations/client/lint_ci.mutation.graphql | 1 - .../fragments/snippet_base.fragment.graphql | 35 ------------------- .../work_items/graphql/typedefs.graphql | 19 ++++++++-- .../graphql/board_scope.fragment.graphql | 4 +-- 9 files changed, 34 insertions(+), 54 deletions(-) delete mode 100644 app/assets/javascripts/graphql_shared/fragments/blobviewer.fragment.graphql delete mode 100644 app/assets/javascripts/graphql_shared/fragments/iteration.fragment.graphql delete mode 100644 app/assets/javascripts/snippets/fragments/snippet_base.fragment.graphql diff --git a/.eslintrc.yml b/.eslintrc.yml index d268d73e6a618..22dae35187e2f 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -174,3 +174,6 @@ overrides: '@graphql-eslint/no-anonymous-operations': error '@graphql-eslint/unique-operation-name': error '@graphql-eslint/require-id-when-available': error + '@graphql-eslint/no-unused-variables': error + '@graphql-eslint/no-unused-fragments': error + '@graphql-eslint/no-duplicate-fields': error diff --git a/app/assets/javascripts/editor/graphql/typedefs.graphql b/app/assets/javascripts/editor/graphql/typedefs.graphql index 2433ebf6c663f..49beae033f1bc 100644 --- a/app/assets/javascripts/editor/graphql/typedefs.graphql +++ b/app/assets/javascripts/editor/graphql/typedefs.graphql @@ -12,12 +12,22 @@ type Items { nodes: [Item]! } +input ItemInput { + id: ID! + label: String! + icon: String + selected: Boolean + group: Int! + category: String + selectedLabel: String +} + extend type Query { items: Items } extend type Mutation { - updateToolbarItem(id: ID!, propsToUpdate: Item!): LocalErrors + updateToolbarItem(id: ID!, propsToUpdate: ItemInput!): LocalErrors removeToolbarItems(ids: [ID!]): LocalErrors - addToolbarItems(items: [Item]): LocalErrors + addToolbarItems(items: [ItemInput]): LocalErrors } diff --git a/app/assets/javascripts/environments/graphql/queries/environment_app.query.graphql b/app/assets/javascripts/environments/graphql/queries/environment_app.query.graphql index 2c17c42dd6d49..c3ab9cf7fca5a 100644 --- a/app/assets/javascripts/environments/graphql/queries/environment_app.query.graphql +++ b/app/assets/javascripts/environments/graphql/queries/environment_app.query.graphql @@ -4,6 +4,5 @@ query getEnvironmentApp($page: Int, $scope: String) { stoppedCount environments reviewApp - stoppedCount } } diff --git a/app/assets/javascripts/graphql_shared/fragments/blobviewer.fragment.graphql b/app/assets/javascripts/graphql_shared/fragments/blobviewer.fragment.graphql deleted file mode 100644 index b202ed12f8029..0000000000000 --- a/app/assets/javascripts/graphql_shared/fragments/blobviewer.fragment.graphql +++ /dev/null @@ -1,7 +0,0 @@ -fragment BlobViewer on SnippetBlobViewer { - collapsed - renderError - tooLarge - type - fileType -} diff --git a/app/assets/javascripts/graphql_shared/fragments/iteration.fragment.graphql b/app/assets/javascripts/graphql_shared/fragments/iteration.fragment.graphql deleted file mode 100644 index 78a368089a80e..0000000000000 --- a/app/assets/javascripts/graphql_shared/fragments/iteration.fragment.graphql +++ /dev/null @@ -1,4 +0,0 @@ -fragment Iteration on Iteration { - id - title -} diff --git a/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql b/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql index 5091d63111f6f..2d42ebb6ac376 100644 --- a/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql +++ b/app/assets/javascripts/pipeline_editor/graphql/mutations/client/lint_ci.mutation.graphql @@ -13,7 +13,6 @@ mutation lintCI($endpoint: String, $content: String, $dry: Boolean) { only { refs } - afterScript stage tags when diff --git a/app/assets/javascripts/snippets/fragments/snippet_base.fragment.graphql b/app/assets/javascripts/snippets/fragments/snippet_base.fragment.graphql deleted file mode 100644 index d75b4011d1c07..0000000000000 --- a/app/assets/javascripts/snippets/fragments/snippet_base.fragment.graphql +++ /dev/null @@ -1,35 +0,0 @@ -#import '~/graphql_shared/fragments/blobviewer.fragment.graphql' - -fragment SnippetBase on Snippet { - id - title - description - descriptionHtml - createdAt - updatedAt - visibilityLevel - webUrl - httpUrlToRepo - sshUrlToRepo - blobs { - nodes { - binary - name - path - rawPath - size - externalStorage - renderedAsText - simpleViewer { - ...BlobViewer - } - richViewer { - ...BlobViewer - } - } - } - userPermissions { - adminSnippet - updateSnippet - } -} diff --git a/app/assets/javascripts/work_items/graphql/typedefs.graphql b/app/assets/javascripts/work_items/graphql/typedefs.graphql index 44a2999a72e9a..36ffba8a540e9 100644 --- a/app/assets/javascripts/work_items/graphql/typedefs.graphql +++ b/app/assets/javascripts/work_items/graphql/typedefs.graphql @@ -22,10 +22,25 @@ extend type WorkItem { mockWidgets: [LocalWorkItemWidget] } +input LocalUserInput { + id: ID! + name: String + username: String + webUrl: String + avatarUrl: String +} + +input LocalLabelInput { + id: ID! + title: String! + color: String + description: String +} + input LocalUpdateWorkItemInput { id: WorkItemID! - assignees: [UserCore!] - labels: [Label] + assignees: [LocalUserInput!] + labels: [LocalLabelInput] } type LocalWorkItemPayload { diff --git a/ee/app/assets/javascripts/boards/graphql/board_scope.fragment.graphql b/ee/app/assets/javascripts/boards/graphql/board_scope.fragment.graphql index ae3d5f9750989..1bbe56426fb01 100644 --- a/ee/app/assets/javascripts/boards/graphql/board_scope.fragment.graphql +++ b/ee/app/assets/javascripts/boards/graphql/board_scope.fragment.graphql @@ -1,6 +1,5 @@ #import "~/graphql_shared/fragments/user.fragment.graphql" #import "~/graphql_shared/fragments/label.fragment.graphql" -#import "~/graphql_shared/fragments/iteration.fragment.graphql" fragment BoardScopeFragment on Board { id @@ -20,7 +19,8 @@ fragment BoardScopeFragment on Board { } } iteration { - ...Iteration + id + title } iterationCadence { id -- GitLab