Commit e674bde4 authored by Natalia Tepluhina's avatar Natalia Tepluhina Committed by Vitaly Slobodin

Add GraphQL ESLint plugin to the codebase

parent 721c7bbb
......@@ -7,3 +7,5 @@
/tmp/
/vendor/
/sitespeed-result/
/fixtures/**/*.graphql
spec/fixtures/**/*.graphql
......@@ -113,3 +113,24 @@ overrides:
- '*.stories.js'
rules:
filenames/match-regex: off
- files:
- '*.graphql'
plugins:
- '@graphql-eslint'
parserOptions:
parser: '@graphql-eslint/eslint-plugin'
operations:
- '{,ee/,jh/}app/**/*.graphql'
# You can run `bundle exec rake gitlab:graphql:schema:dump` and then uncomment this line
# schema: './tmp/tests/graphql/gitlab_schema.graphql'
rules:
filenames/match-regex: off
spaced-comment: off
# TODO: We need a way to include this rule + support ee_else_ce fragments
#'@graphql-eslint/unique-fragment-name': error
# TODO: Uncomment these rules when then `schema` is available
#'@graphql-eslint/fragments-on-composite-type': error
#'@graphql-eslint/known-argument-names': error
#'@graphql-eslint/known-type-names': error
'@graphql-eslint/no-anonymous-operations': error
'@graphql-eslint/unique-operation-name': error
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getProjects(
query accessTokensGetProjects(
$search: String = ""
$after: String = ""
$first: Int = null
......
query getGroupProjects(
query analyticsGetGroupProjects(
$groupFullPath: ID!
$search: String!
$first: Int!
......
#import "./board_list.fragment.graphql"
mutation CreateBoardList($boardId: BoardID!, $backlog: Boolean, $labelId: LabelID) {
mutation createBoardList($boardId: BoardID!, $backlog: Boolean, $labelId: LabelID) {
boardListCreate(input: { boardId: $boardId, backlog: $backlog, labelId: $labelId }) {
list {
...BoardListFragment
......
#import "ee_else_ce/boards/graphql/board_list.fragment.graphql"
query ListIssues(
query BoardLists(
$fullPath: ID!
$boardId: ID!
$filters: BoardIssueInput
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getGroupProjects($fullPath: ID!, $search: String, $after: String) {
query boardsGetGroupProjects($fullPath: ID!, $search: String, $after: String) {
group(fullPath: $fullPath) {
projects(search: $search, after: $after, first: 100, includeSubgroups: true) {
nodes {
......
#import "ee_else_ce/boards/graphql/issue.fragment.graphql"
mutation IssueMoveList(
mutation issueMoveList(
$projectPath: ID!
$iid: String!
$boardId: ID!
......
#import "ee_else_ce/boards/graphql/issue.fragment.graphql"
query ListIssues(
query BoardListEE(
$fullPath: ID!
$boardId: ID!
$id: ID
......
query projectMilestones(
query boardProjectMilestones(
$fullPath: ID!
$state: MilestoneStateEnum
$includeAncestors: Boolean
......
mutation($environment: Environment) {
mutation cancelAutoStop($environment: Environment) {
cancelAutoStop(environment: $environment) @client {
errors
}
......
mutation($environment: Environment) {
mutation deleteEnvironment($environment: Environment) {
deleteEnvironment(environment: $environment) @client {
errors
}
......
mutation($environment: Environment) {
mutation rollbackEnvironment($environment: Environment) {
rollbackEnvironment(environment: $environment) @client {
errors
}
......
mutation($environment: Environment) {
mutation stopEnvironment($environment: Environment) {
stopEnvironment(environment: $environment) @client {
errors
}
......
mutation($input: EnvironmentsCanaryIngressUpdateInput!) {
mutation updateCanaryIngress($input: EnvironmentsCanaryIngressUpdateInput!) {
environmentsCanaryIngressUpdate(input: $input) {
errors
}
......
#import "../fragments/user.fragment.graphql"
#import "~/graphql_shared/fragments/user_availability.fragment.graphql"
query usersSearch($search: String!, $fullPath: ID!) {
query groupUsersSearch($search: String!, $fullPath: ID!) {
workspace: group(fullPath: $fullPath) {
id
users: groupMembers(search: $search, relations: [DIRECT, INHERITED]) {
......
#import "../fragments/user.fragment.graphql"
#import "~/graphql_shared/fragments/user_availability.fragment.graphql"
query usersSearch($search: String!, $fullPath: ID!) {
query projectUsersSearch($search: String!, $fullPath: ID!) {
workspace: project(fullPath: $fullPath) {
users: projectMembers(search: $search, relations: [DIRECT, INHERITED, INVITED_GROUPS]) {
nodes {
......
query($fullPath: ID!) {
query getIssuesListDetails($fullPath: ID!) {
project(fullPath: $fullPath) {
issues {
nodes {
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getProjects(
query jiraGetProjects(
$search: String!
$after: String = ""
$first: Int!
......
#import "./jira_import.fragment.graphql"
query($fullPath: ID!) {
query getJiraImportDetails($fullPath: ID!) {
project(fullPath: $fullPath) {
jiraImportStatus
jiraImports {
......
mutation($input: JiraImportUsersInput!) {
mutation getJiraUserMapping($input: JiraImportUsersInput!) {
jiraImportUsers(input: $input) {
jiraUsers {
jiraAccountId
......
#import "./jira_import.fragment.graphql"
mutation($input: JiraImportStartInput!) {
mutation initiateJiraImport($input: JiraImportStartInput!) {
jiraImportStart(input: $input) {
jiraImport {
...JiraImport
......
query searchProjectMembers($fullPath: ID!, $search: String) {
query jiraSearchProjectMembers($fullPath: ID!, $search: String) {
project(fullPath: $fullPath) {
projectMembers(search: $search) {
nodes {
......
......@@ -6,7 +6,7 @@
# When the `releases_index_apollo_client` feature flag is
# removed, this query should be removed entirely.
query allReleases(
query allReleasesDeprecated(
$fullPath: ID!
$first: Int
$last: Int
......
query($fullPath: ID!, $iid: String!) {
query sidebarDetails($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue(iid: $iid) {
iid
......
mutation($projectPath: ID!, $iid: String!, $healthStatus: HealthStatus) {
mutation updateIssueHealthStatus($projectPath: ID!, $iid: String!, $healthStatus: HealthStatus) {
updateIssue(input: { projectPath: $projectPath, iid: $iid, healthStatus: $healthStatus }) {
issuable: issue {
id
......
mutation updateEpic($input: UpdateEpicInput!) {
mutation updateIssuableConfidential($input: UpdateEpicInput!) {
issuableSetConfidential: updateEpic(input: $input) {
issuable: epic {
id
......
mutation epicSetSubscription($fullPath: ID!, $iid: ID!, $subscribedState: Boolean!) {
mutation boardEpicSetSubscription($fullPath: ID!, $iid: ID!, $subscribedState: Boolean!) {
updateIssuableSubscription: epicSetSubscription(
input: { groupPath: $fullPath, iid: $iid, subscribedState: $subscribedState }
) {
......
mutation updateEpic($input: UpdateEpicInput!) {
mutation updateEpicTitle($input: UpdateEpicInput!) {
updateIssuableTitle: updateEpic(input: $input) {
epic {
title
......
mutation issueSetSubscription($fullPath: ID!, $iid: String!, $subscribedState: Boolean!) {
mutation projectIssueSetSubscription($fullPath: ID!, $iid: String!, $subscribedState: Boolean!) {
updateIssuableSubscription: issueSetSubscription(
input: { projectPath: $fullPath, iid: $iid, subscribedState: $subscribedState }
) {
......
query getIssues($projectPath: ID!) {
query getProjectIssues($projectPath: ID!) {
project(fullPath: $projectPath) {
issues {
count
......
#import "./auto_merge_enabled.fragment.graphql"
query autoMergeEnabledQuery($projectPath: ID!, $iid: String!) {
query autoMergeEnabled($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
mergeRequest(iid: $iid) {
...autoMergeEnabled
......
query workInProgressQuery($projectPath: ID!, $iid: String!) {
query workInProgress($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
mergeRequest(iid: $iid) {
shouldBeRebased
......
query readyToMergeQuery($projectPath: ID!, $iid: String!) {
query getReadyToMergeStatus($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
mergeRequest(iid: $iid) {
userPermissions {
......
#import "./ready_to_merge.fragment.graphql"
query readyToMergeQuery($projectPath: ID!, $iid: String!) {
query readyToMerge($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
...ReadyToMerge
}
......
query workInProgressQuery($projectPath: ID!, $iid: String!) {
query mrUserPermission($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
mergeRequest(iid: $iid) {
userPermissions {
......
#import "~/graphql_shared/fragments/alert_detail_item.fragment.graphql"
#import "~/graphql_shared/fragments/user.fragment.graphql"
query alertDetails($fullPath: ID!, $alertId: String) {
query alertDetailsAssignees($fullPath: ID!, $alertId: String) {
project(fullPath: $fullPath) {
alertManagementAlerts(iid: $alertId) {
nodes {
......
#import "~/graphql_shared/fragments/label.fragment.graphql"
mutation updateEpic($input: UpdateEpicInput!) {
mutation updateEpicLabels($input: UpdateEpicInput!) {
updateEpic(input: $input) {
epic {
id
......
#import "~/graphql_shared/fragments/issuable_timelogs.fragment.graphql"
query timeTrackingReport($id: IssueID!) {
query issueTimeTrackingReport($id: IssueID!) {
issuable: issue(id: $id) {
__typename
id
......
#import "~/graphql_shared/fragments/issuable_timelogs.fragment.graphql"
query timeTrackingReport($id: MergeRequestID!) {
query mrTimeTrackingReport($id: MergeRequestID!) {
issuable: mergeRequest(id: $id) {
__typename
id
......
#import "../fragments/job_artifacts.fragment.graphql"
query getCorpuses($projectPath: ID!, $iid: ID, $reportTypes: [SecurityReportTypeEnum!]) {
query getPipelineCorpuses($projectPath: ID!, $iid: ID, $reportTypes: [SecurityReportTypeEnum!]) {
project(fullPath: $projectPath) {
pipeline(iid: $iid) {
id
......
#import "../fragments/license.fragment.graphql"
mutation($gitlabSubscriptionActivateInput: GitlabSubscriptionActivateInput!) {
mutation activateSubscription($gitlabSubscriptionActivateInput: GitlabSubscriptionActivateInput!) {
gitlabSubscriptionActivate(input: $gitlabSubscriptionActivateInput) {
errors
license {
......
#import "~/alerts_settings/graphql/fragments/http_integration_item.fragment.graphql"
mutation createHttpIntegration(
mutation createHttpIntegrationEE(
$projectPath: ID!
$name: String!
$active: Boolean!
......
#import "~/alerts_settings/graphql/fragments/http_integration_item.fragment.graphql"
mutation updateHttpIntegration(
mutation updateHttpIntegrationEE(
$id: ID!
$name: String!
$active: Boolean!
......
#import "../fragments/latest_snapshot.fragment.graphql"
#import "../fragments/namespace.fragment.graphql"
mutation($namespaceIds: [NamespaceID!]!, $displayNamespaceId: NamespaceID) {
mutation bulkEnableDevopsAdoptionNamespaces(
$namespaceIds: [NamespaceID!]!
$displayNamespaceId: NamespaceID
) {
bulkEnableDevopsAdoptionNamespaces(
input: { namespaceIds: $namespaceIds, displayNamespaceId: $displayNamespaceId }
) {
......
mutation($id: [AnalyticsDevopsAdoptionEnabledNamespaceID!]!) {
mutation disableDevopsAdoptionNamespace($id: [AnalyticsDevopsAdoptionEnabledNamespaceID!]!) {
disableDevopsAdoptionNamespace(input: { id: $id }) {
errors
}
......
query devopsAdoptionEnabledNamespaces(
query devopsAdoptionOverviewChart(
$displayNamespaceId: NamespaceID
$startDate: Time!
$endDate: Time!
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getGroupProjects($groupFullPath: ID!, $after: String) {
query repoAnalyticsGetGroupProjects($groupFullPath: ID!, $after: String) {
group(fullPath: $groupFullPath) {
projects(hasCodeCoverage: true, after: $after, first: 100) {
nodes {
......
#import "./board_list.fragment.graphql"
mutation CreateBoardList(
mutation createBoardListEE(
$boardId: BoardID!
$backlog: Boolean
$labelId: LabelID
......
#import "./epic_board_list.fragment.graphql"
query ListEpics($fullPath: ID!, $boardId: BoardsEpicBoardID!, $filters: EpicFilters) {
query boardListEpics($fullPath: ID!, $boardId: BoardsEpicBoardID!, $filters: EpicFilters) {
group(fullPath: $fullPath) {
board: epicBoard(id: $boardId) {
lists(epicFilters: $filters) {
......
#import "ee_else_ce/boards/graphql/issue.fragment.graphql"
mutation IssueMoveList(
mutation issueMoveListEE(
$projectPath: ID!
$iid: String!
$boardId: ID!
......
#import "ee/graphql_shared/fragments/epic.fragment.graphql"
#import "~/graphql_shared/fragments/label.fragment.graphql"
query ListEpics(
query epicBoardListEpics(
$fullPath: ID!
$boardId: BoardsEpicBoardID!
$id: BoardsEpicListID
......
mutation updateEpic($input: UpdateEpicInput!) {
mutation updateBoardEpicLabels($input: UpdateEpicInput!) {
updateEpic(input: $input) {
epic {
id
......
#import "~/ide/queries/ide_project.fragment.graphql"
query getIdeProject($projectPath: ID!) {
query getIdeProjectEE($projectPath: ID!) {
project(fullPath: $projectPath) {
...IdeProject
pushRules {
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "~/issues_list/queries/issue.fragment.graphql"
query getIssues(
query getIssuesEE(
$isProject: Boolean = false
$isSignedIn: Boolean = false
$fullPath: ID!
......
query getIssuesCount(
query getIssuesCountEE(
$isProject: Boolean = false
$fullPath: ID!
$search: String
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query IterationCadences(
query groupIterationCadences(
$fullPath: ID!
$beforeCursor: String = ""
$afterCursor: String = ""
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "./iteration_list_item.fragment.graphql"
query Iterations(
query groupIterations(
$fullPath: ID!
$iterationCadenceId: ID!
$state: IterationState!
......
mutation createIteration($input: iterationCreateInput!) {
mutation createIteration2($input: iterationCreateInput!) {
iterationCreate(input: $input) {
iteration {
id
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "./iteration_list_item.fragment.graphql"
query Iterations(
query workspaceIterations(
$fullPath: ID!
$isGroup: Boolean = true
$state: IterationState!
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query IterationCadences(
query projectIterationCadences(
$fullPath: ID!
$beforeCursor: String = ""
$afterCursor: String = ""
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "./epic.fragment.graphql"
query groupEpics(
query roadmapGroupEpics(
$fullPath: ID!
$state: EpicState
$sort: EpicSort
......
query groupMilestones(
query groupMilestonesEE(
$fullPath: ID!
$state: MilestoneStateEnum
$timeframe: Timeframe
......
mutation($input: ApiFuzzingCiConfigurationCreateInput!) {
mutation createApiFuzzingCiConfiguration($input: ApiFuzzingCiConfigurationCreateInput!) {
apiFuzzingCiConfigurationCreate(input: $input) {
configurationYaml
gitlabCiYamlEditPath
......
mutation($id: VulnerabilityID!) {
mutation vulnerabilityConfirm($id: VulnerabilityID!) {
vulnerabilityConfirm(input: { id: $id }) {
errors
vulnerability {
......
mutation($id: VulnerabilityID!, $comment: String!) {
mutation vulnerabilityDismiss($id: VulnerabilityID!, $comment: String!) {
vulnerabilityDismiss(input: { id: $id, comment: $comment }) {
errors
vulnerability {
......
mutation($id: VulnerabilityID!) {
mutation vulnerabilityResolve($id: VulnerabilityID!) {
vulnerabilityResolve(input: { id: $id }) {
errors
vulnerability {
......
mutation($id: VulnerabilityID!) {
mutation vulnerabilityRevertToDetected($id: VulnerabilityID!) {
vulnerabilityRevertToDetected(input: { id: $id }) {
errors
vulnerability {
......
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
query getProjects(
query securityGetProjects(
$search: String!
$after: String = ""
$first: Int!
......
#import "./iteration.fragment.graphql"
query issueIterations($fullPath: ID!, $title: String, $state: IterationState) {
query issueIterationsAliased($fullPath: ID!, $title: String, $state: IterationState) {
workspace: group(fullPath: $fullPath) {
__typename
attributes: iterations(title: $title, state: $state) {
......
query($fullPath: ID!, $iid: String!) {
query getIssueHealthStatus($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue(iid: $iid) {
healthStatus
......
query State($countryId: ID!) {
query States($countryId: ID!) {
states(countryId: $countryId) @client {
id
name
......
#import "~/vue_merge_request_widget/queries/states/auto_merge_enabled.fragment.graphql"
query autoMergeEnabledQuery($projectPath: ID!, $iid: String!) {
query autoMergeEnabledEE($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
mergeRequest(iid: $iid) {
...autoMergeEnabled
......
#import "~/vue_merge_request_widget/queries/states/ready_to_merge.fragment.graphql"
query readyToMergeQuery($projectPath: ID!, $iid: String!) {
query readyToMergeEE($projectPath: ID!, $iid: String!) {
project(fullPath: $projectPath) {
...ReadyToMerge
mergeRequest(iid: $iid) {
......
query($fullPath: ID!, $pipelineIid: ID!) {
query getSecurityReportSummary($fullPath: ID!, $pipelineIid: ID!) {
project(fullPath: $fullPath) {
pipeline(iid: $pipelineIid) {
securityReportSummary {
......
......@@ -8,7 +8,7 @@
"dev-server": "NODE_OPTIONS=\"--max-old-space-size=3584\" node scripts/frontend/webpack_dev_server.js",
"file-coverage": "scripts/frontend/file_test_coverage.js",
"lint-docs": "scripts/lint-doc.sh",
"internal:eslint": "eslint --cache --max-warnings 0 --report-unused-disable-directives --ext .js,.vue",
"internal:eslint": "eslint --cache --max-warnings 0 --report-unused-disable-directives --ext .js,.vue,.graphql",
"internal:stylelint": "stylelint -q '{ee/,}app/assets/stylesheets/**/*.{css,scss}'",
"prejest": "yarn check-dependencies",
"jest": "jest --config jest.config.js",
......@@ -205,6 +205,7 @@
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@gitlab/eslint-plugin": "10.0.0",
"@gitlab/stylelint-config": "2.6.0",
"@graphql-eslint/eslint-plugin": "^2.3.0",
"@testing-library/dom": "^7.16.2",
"@vue/test-utils": "1.2.0",
"acorn": "^6.3.0",
......@@ -261,7 +262,8 @@
"bootstrap-vue": "https://docs.gitlab.com/ee/development/fe_guide/dependencies.html#bootstrapvue"
},
"resolutions": {
"chokidar": "^3.4.0"
"chokidar": "^3.4.0",
"@types/node": "14.17.5"
},
"engines": {
"node": ">=12.22.1",
......
This diff is collapsed.
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