Commit 07525a17 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'vs/ci-add-graphql-linting-with-apollo' into 'master'

Add new CI job for linting GraphQL with Apollo

See merge request gitlab-org/gitlab!75220
parents 6944a912 dbc8e52c
......@@ -138,4 +138,4 @@ overrides:
#'@graphql-eslint/known-type-names': error
'@graphql-eslint/no-anonymous-operations': 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/
webpack-dev-server.json
/.nvimrc
.solargraph.yml
apollo.config.js
/tmp/matching_foss_tests.txt
/tmp/matching_tests.txt
ee/changelogs/unreleased-ee
......
......@@ -10,6 +10,7 @@
# Disable warnings in browserslist which can break on backports
# https://github.com/browserslist/browserslist/blob/a287ec6/node.js#L367-L384
BROWSERSLIST_IGNORE_OLD_DATA: "true"
GRAPHQL_SCHEMA_APOLLO_FILE: "tmp/tests/graphql/gitlab_schema_apollo.graphql"
update-static-analysis-cache:
extends:
......@@ -47,17 +48,34 @@ static-verification-with-database:
variables:
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:
extends:
- .static-analysis-base
- .yarn-cache
- .static-analysis:rules:ee
needs: []
- .frontend:rules:default-frontend-jobs
needs: ['generate-apollo-graphl-schema']
variables:
USE_BUNDLE_INSTALL: "false"
script:
- 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:
extends:
......
......@@ -4,8 +4,7 @@ mutation createHttpIntegration($projectPath: ID!, $name: String!, $active: Boole
httpIntegrationCreate(input: { projectPath: $projectPath, name: $name, active: $active }) {
errors
# 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 {
...HttpIntegrationItem
}
......
......@@ -4,8 +4,7 @@ mutation destroyHttpIntegration($id: ID!) {
httpIntegrationDestroy(input: { id: $id }) {
errors
# 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 {
...HttpIntegrationItem
}
......
......@@ -4,8 +4,7 @@ mutation resetHttpIntegrationToken($id: ID!) {
httpIntegrationResetToken(input: { id: $id }) {
errors
# 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 {
...HttpIntegrationItem
}
......
......@@ -4,8 +4,7 @@ mutation updateHttpIntegration($id: ID!, $name: String!, $active: Boolean!) {
httpIntegrationUpdate(input: { id: $id, name: $name, active: $active }) {
errors
# 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 {
...HttpIntegrationItem
}
......
......@@ -3,8 +3,7 @@
mutation createBoardList($boardId: BoardID!, $backlog: Boolean, $labelId: LabelID) {
boardListCreate(input: { boardId: $boardId, backlog: $backlog, labelId: $labelId }) {
# 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 {
...BoardListFragment
}
......
......@@ -3,8 +3,7 @@
mutation UpdateBoardList($listId: ID!, $position: Int, $collapsed: Boolean) {
updateBoardList(input: { listId: $listId, position: $position, collapsed: $collapsed }) {
# 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 {
...BoardListFragment
}
......
......@@ -14,8 +14,7 @@ query BoardLists(
hideBacklogList
lists(issueFilters: $filters) {
# 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 {
...BoardListFragment
}
......@@ -29,8 +28,7 @@ query BoardLists(
hideBacklogList
lists(issueFilters: $filters) {
# 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 {
...BoardListFragment
}
......
......@@ -3,8 +3,7 @@
mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) {
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 {
...DesignItem
versions {
......
......@@ -13,8 +13,7 @@ query getDesign(
id
designCollection {
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 {
...DesignItem
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 {
status {
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 {
severity
}
......@@ -2,8 +2,7 @@
query getRunner($id: CiRunnerID!) {
# 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) {
...RunnerDetails
}
......
......@@ -6,8 +6,7 @@
mutation runnerUpdate($input: RunnerUpdateInput!) {
runnerUpdate(input: $input) {
# 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 {
...RunnerDetails
}
......
......@@ -72,8 +72,7 @@ query childItems(
edges {
__typename
# 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 {
__typename
...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(
) {
errors
# 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 {
...HttpIntegrationItem
}
......
......@@ -18,8 +18,7 @@ mutation updateHttpIntegrationEE(
) {
errors
# 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 {
...HttpIntegrationItem
}
......
......@@ -19,8 +19,7 @@ mutation createBoardListEE(
}
) {
# 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 {
...BoardListFragment
}
......
......@@ -14,8 +14,7 @@ query ListIssues(
hideBacklogList
lists(issueFilters: $filters) {
# 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 {
...BoardListFragment
}
......@@ -29,8 +28,7 @@ query ListIssues(
hideBacklogList
lists(issueFilters: $filters) {
# 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 {
...BoardListFragment
}
......
......@@ -4,8 +4,7 @@
mutation CreateEpic($input: CreateEpicInput!) {
createEpic(input: $input) {
# 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 {
...EpicNode
labels {
......
......@@ -3,8 +3,7 @@
mutation boardListUpdateLimitMetrics($input: BoardListUpdateLimitMetricsInput!) {
boardListUpdateLimitMetrics(input: $input) {
# 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 {
...BoardListFragment
}
......
......@@ -19,8 +19,7 @@ query epicBoardListEpics(
epics(first: $first, after: $after, filters: $filters) {
edges {
# 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 {
...EpicNode
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 {
severity
statusPagePublishedIncident
......
......@@ -7,8 +7,7 @@ query getShiftsForRotations($projectPath: ID!, $startsAt: Time!, $endsAt: Time!,
nodes {
rotations {
# 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 {
...OnCallRotationWithShifts
}
......
#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 {
vulnerabilitySeveritiesCount(state: [DETECTED, CONFIRMED]) {
...VulnerabilitySeveritiesCount
......
......@@ -10,8 +10,7 @@ query searchEpics($fullPath: ID!, $search: String, $state: EpicState) {
includeDescendantGroups: false
) {
# 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 {
...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