Commit dbc8e52c authored by Vitaly Slobodin's avatar Vitaly Slobodin Committed by Rémy Coutable

Add new CI job for linting GraphQL with Apollo

parent 35bccfc3
...@@ -138,4 +138,4 @@ overrides: ...@@ -138,4 +138,4 @@ overrides:
#'@graphql-eslint/known-type-names': error #'@graphql-eslint/known-type-names': error
'@graphql-eslint/no-anonymous-operations': error '@graphql-eslint/no-anonymous-operations': error
'@graphql-eslint/unique-operation-name': error '@graphql-eslint/unique-operation-name': error
# '@graphql-eslint/require-id-when-available': error '@graphql-eslint/require-id-when-available': error
...@@ -95,7 +95,6 @@ jsdoc/ ...@@ -95,7 +95,6 @@ jsdoc/
webpack-dev-server.json webpack-dev-server.json
/.nvimrc /.nvimrc
.solargraph.yml .solargraph.yml
apollo.config.js
/tmp/matching_foss_tests.txt /tmp/matching_foss_tests.txt
/tmp/matching_tests.txt /tmp/matching_tests.txt
ee/changelogs/unreleased-ee ee/changelogs/unreleased-ee
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
# Disable warnings in browserslist which can break on backports # Disable warnings in browserslist which can break on backports
# https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384 # https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384
BROWSERSLIST_IGNORE_OLD_DATA: "true" BROWSERSLIST_IGNORE_OLD_DATA: "true"
GRAPHQL_SCHEMA_APOLLO_FILE: "tmp/tests/graphql/gitlab_schema_apollo.graphql"
update-static-analysis-cache: update-static-analysis-cache:
extends: extends:
...@@ -47,17 +48,34 @@ static-verification-with-database: ...@@ -47,17 +48,34 @@ static-verification-with-database:
variables: variables:
SETUP_DB: "true" SETUP_DB: "true"
generate-apollo-graphl-schema:
extends:
- .static-analysis-base
- .frontend:rules:default-frontend-jobs
image:
name: registry.gitlab.com/gitlab-org/gitlab-build-images:apollo
entrypoint: [""]
needs: ['graphql-schema-dump']
variables:
USE_BUNDLE_INSTALL: "false"
script:
- apollo client:download-schema --config=config/apollo.config.js ${GRAPHQL_SCHEMA_APOLLO_FILE}
artifacts:
name: graphql-schema-apollo
paths:
- "${GRAPHQL_SCHEMA_APOLLO_FILE}"
eslint: eslint:
extends: extends:
- .static-analysis-base - .static-analysis-base
- .yarn-cache - .yarn-cache
- .static-analysis:rules:ee - .frontend:rules:default-frontend-jobs
needs: [] needs: ['generate-apollo-graphl-schema']
variables: variables:
USE_BUNDLE_INSTALL: "false" USE_BUNDLE_INSTALL: "false"
script: script:
- run_timed_command "retry yarn install --frozen-lockfile" - run_timed_command "retry yarn install --frozen-lockfile"
- run_timed_command "yarn run lint:eslint:all" - run_timed_command "yarn run lint:eslint:all --parser-options=schema:${GRAPHQL_SCHEMA_APOLLO_FILE}"
eslint as-if-foss: eslint as-if-foss:
extends: extends:
......
...@@ -4,8 +4,7 @@ mutation createHttpIntegration($projectPath: ID!, $name: String!, $active: Boole ...@@ -4,8 +4,7 @@ mutation createHttpIntegration($projectPath: ID!, $name: String!, $active: Boole
httpIntegrationCreate(input: { projectPath: $projectPath, name: $name, active: $active }) { httpIntegrationCreate(input: { projectPath: $projectPath, name: $name, active: $active }) {
errors errors
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
integration { integration {
...HttpIntegrationItem ...HttpIntegrationItem
} }
......
...@@ -4,8 +4,7 @@ mutation destroyHttpIntegration($id: ID!) { ...@@ -4,8 +4,7 @@ mutation destroyHttpIntegration($id: ID!) {
httpIntegrationDestroy(input: { id: $id }) { httpIntegrationDestroy(input: { id: $id }) {
errors errors
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
integration { integration {
...HttpIntegrationItem ...HttpIntegrationItem
} }
......
...@@ -4,8 +4,7 @@ mutation resetHttpIntegrationToken($id: ID!) { ...@@ -4,8 +4,7 @@ mutation resetHttpIntegrationToken($id: ID!) {
httpIntegrationResetToken(input: { id: $id }) { httpIntegrationResetToken(input: { id: $id }) {
errors errors
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
integration { integration {
...HttpIntegrationItem ...HttpIntegrationItem
} }
......
...@@ -4,8 +4,7 @@ mutation updateHttpIntegration($id: ID!, $name: String!, $active: Boolean!) { ...@@ -4,8 +4,7 @@ mutation updateHttpIntegration($id: ID!, $name: String!, $active: Boolean!) {
httpIntegrationUpdate(input: { id: $id, name: $name, active: $active }) { httpIntegrationUpdate(input: { id: $id, name: $name, active: $active }) {
errors errors
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
integration { integration {
...HttpIntegrationItem ...HttpIntegrationItem
} }
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
mutation createBoardList($boardId: BoardID!, $backlog: Boolean, $labelId: LabelID) { mutation createBoardList($boardId: BoardID!, $backlog: Boolean, $labelId: LabelID) {
boardListCreate(input: { boardId: $boardId, backlog: $backlog, labelId: $labelId }) { boardListCreate(input: { boardId: $boardId, backlog: $backlog, labelId: $labelId }) {
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
list { list {
...BoardListFragment ...BoardListFragment
} }
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
mutation UpdateBoardList($listId: ID!, $position: Int, $collapsed: Boolean) { mutation UpdateBoardList($listId: ID!, $position: Int, $collapsed: Boolean) {
updateBoardList(input: { listId: $listId, position: $position, collapsed: $collapsed }) { updateBoardList(input: { listId: $listId, position: $position, collapsed: $collapsed }) {
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
list { list {
...BoardListFragment ...BoardListFragment
} }
......
...@@ -14,8 +14,7 @@ query BoardLists( ...@@ -14,8 +14,7 @@ query BoardLists(
hideBacklogList hideBacklogList
lists(issueFilters: $filters) { lists(issueFilters: $filters) {
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...BoardListFragment ...BoardListFragment
} }
...@@ -29,8 +28,7 @@ query BoardLists( ...@@ -29,8 +28,7 @@ query BoardLists(
hideBacklogList hideBacklogList
lists(issueFilters: $filters) { lists(issueFilters: $filters) {
# We have ID in a deeply nested fragment # We have ID in a deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...BoardListFragment ...BoardListFragment
} }
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) { mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) {
designManagementUpload(input: { projectPath: $projectPath, iid: $iid, files: $files }) { designManagementUpload(input: { projectPath: $projectPath, iid: $iid, files: $files }) {
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
designs { designs {
...DesignItem ...DesignItem
versions { versions {
......
...@@ -13,8 +13,7 @@ query getDesign( ...@@ -13,8 +13,7 @@ query getDesign(
id id
designCollection { designCollection {
designs(atVersion: $atVersion, filenames: $filenames) { designs(atVersion: $atVersion, filenames: $filenames) {
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...DesignItem ...DesignItem
issue { issue {
......
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
fragment UserAvailability on User { fragment UserAvailability on User {
status { status {
availability availability
......
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
fragment IncidentFields on Issue { fragment IncidentFields on Issue {
severity severity
} }
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
query getRunner($id: CiRunnerID!) { query getRunner($id: CiRunnerID!) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
runner(id: $id) { runner(id: $id) {
...RunnerDetails ...RunnerDetails
} }
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
mutation runnerUpdate($input: RunnerUpdateInput!) { mutation runnerUpdate($input: RunnerUpdateInput!) {
runnerUpdate(input: $input) { runnerUpdate(input: $input) {
# We have an id in deep nested fragment # We have an id in deep nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
runner { runner {
...RunnerDetails ...RunnerDetails
} }
......
...@@ -72,8 +72,7 @@ query childItems( ...@@ -72,8 +72,7 @@ query childItems(
edges { edges {
__typename __typename
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
node { node {
__typename __typename
...EpicNode ...EpicNode
......
module.exports = {
client: {
service: {
name: 'gitlab',
localSchemaFile: './tmp/tests/graphql/gitlab_schema.graphql',
},
includes: ['../{ee/,jh/,}app/assets/javascripts/**/*.{js,graphql}'],
excludes: ['../{ee/,jh/,}spec/{frontend,frontend_integration}/**/*'],
},
};
...@@ -18,8 +18,7 @@ mutation createHttpIntegrationEE( ...@@ -18,8 +18,7 @@ mutation createHttpIntegrationEE(
) { ) {
errors errors
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
integration { integration {
...HttpIntegrationItem ...HttpIntegrationItem
} }
......
...@@ -18,8 +18,7 @@ mutation updateHttpIntegrationEE( ...@@ -18,8 +18,7 @@ mutation updateHttpIntegrationEE(
) { ) {
errors errors
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
integration { integration {
...HttpIntegrationItem ...HttpIntegrationItem
} }
......
...@@ -19,8 +19,7 @@ mutation createBoardListEE( ...@@ -19,8 +19,7 @@ mutation createBoardListEE(
} }
) { ) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
list { list {
...BoardListFragment ...BoardListFragment
} }
......
...@@ -14,8 +14,7 @@ query ListIssues( ...@@ -14,8 +14,7 @@ query ListIssues(
hideBacklogList hideBacklogList
lists(issueFilters: $filters) { lists(issueFilters: $filters) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...BoardListFragment ...BoardListFragment
} }
...@@ -29,8 +28,7 @@ query ListIssues( ...@@ -29,8 +28,7 @@ query ListIssues(
hideBacklogList hideBacklogList
lists(issueFilters: $filters) { lists(issueFilters: $filters) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...BoardListFragment ...BoardListFragment
} }
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
mutation CreateEpic($input: CreateEpicInput!) { mutation CreateEpic($input: CreateEpicInput!) {
createEpic(input: $input) { createEpic(input: $input) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
epic { epic {
...EpicNode ...EpicNode
labels { labels {
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
mutation boardListUpdateLimitMetrics($input: BoardListUpdateLimitMetricsInput!) { mutation boardListUpdateLimitMetrics($input: BoardListUpdateLimitMetricsInput!) {
boardListUpdateLimitMetrics(input: $input) { boardListUpdateLimitMetrics(input: $input) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
list { list {
...BoardListFragment ...BoardListFragment
} }
......
...@@ -19,8 +19,7 @@ query epicBoardListEpics( ...@@ -19,8 +19,7 @@ query epicBoardListEpics(
epics(first: $first, after: $after, filters: $filters) { epics(first: $first, after: $after, filters: $filters) {
edges { edges {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
node { node {
...EpicNode ...EpicNode
relativePosition relativePosition
......
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
fragment IncidentFields on Issue { fragment IncidentFields on Issue {
severity severity
statusPagePublishedIncident statusPagePublishedIncident
......
...@@ -7,8 +7,7 @@ query getShiftsForRotations($projectPath: ID!, $startsAt: Time!, $endsAt: Time!, ...@@ -7,8 +7,7 @@ query getShiftsForRotations($projectPath: ID!, $startsAt: Time!, $endsAt: Time!,
nodes { nodes {
rotations { rotations {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...OnCallRotationWithShifts ...OnCallRotationWithShifts
} }
......
#import "ee/security_dashboard/graphql/fragments/vulnerability_severities_count.fragment.graphql" #import "ee/security_dashboard/graphql/fragments/vulnerability_severities_count.fragment.graphql"
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
fragment ProjectVulnerabilitySeveritiesCount on Project { fragment ProjectVulnerabilitySeveritiesCount on Project {
vulnerabilitySeveritiesCount(state: [DETECTED, CONFIRMED]) { vulnerabilitySeveritiesCount(state: [DETECTED, CONFIRMED]) {
...VulnerabilitySeveritiesCount ...VulnerabilitySeveritiesCount
......
...@@ -10,8 +10,7 @@ query searchEpics($fullPath: ID!, $search: String, $state: EpicState) { ...@@ -10,8 +10,7 @@ query searchEpics($fullPath: ID!, $search: String, $state: EpicState) {
includeDescendantGroups: false includeDescendantGroups: false
) { ) {
# We have an id in deeply nested fragment # We have an id in deeply nested fragment
# TODO: Uncomment next line when https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75220 is merged and the rule is enabled # eslint-disable-next-line @graphql-eslint/require-id-when-available
# # eslint-disable-next-line @graphql-eslint/require-id-when-available
nodes { nodes {
...EpicNode ...EpicNode
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment