Commit 8f299bc0 authored by Tristan Read's avatar Tristan Read Committed by Natalia Tepluhina

Format graphql files with prettier

parent a2ab7960
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/public/ /public/
/vendor/ /vendor/
/tmp/ /tmp/
doc/api/graphql/reference/gitlab_schema.graphql
# ignore stylesheets for now as this clashes with our linter # ignore stylesheets for now as this clashes with our linter
*.css *.css
......
...@@ -16,5 +16,4 @@ fragment AlertDetailItem on AlertManagementAlert { ...@@ -16,5 +16,4 @@ fragment AlertDetailItem on AlertManagementAlert {
...AlertNote ...AlertNote
} }
} }
} }
mutation createAlertIssue($projectPath: ID!, $iid: String!) { mutation createAlertIssue($projectPath: ID!, $iid: String!) {
createAlertIssue(input: { iid: $iid, projectPath: $projectPath }) { createAlertIssue(input: { iid: $iid, projectPath: $projectPath }) {
errors errors
issue { issue {
iid iid
}
} }
}
} }
mutation toggleSidebarStatus { mutation toggleSidebarStatus {
toggleSidebarStatus @client toggleSidebarStatus @client
} }
...@@ -4,9 +4,9 @@ mutation updateAlertStatus($projectPath: ID!, $status: AlertManagementStatus!, $ ...@@ -4,9 +4,9 @@ mutation updateAlertStatus($projectPath: ID!, $status: AlertManagementStatus!, $
updateAlertStatus(input: { iid: $iid, status: $status, projectPath: $projectPath }) { updateAlertStatus(input: { iid: $iid, status: $status, projectPath: $projectPath }) {
errors errors
alert { alert {
iid, iid
status, status
endedAt, endedAt
notes { notes {
nodes { nodes {
...AlertNote ...AlertNote
......
#import "../fragments/detail_item.fragment.graphql" #import "../fragments/detail_item.fragment.graphql"
query alertDetails($fullPath: ID!, $alertId: String) { query alertDetails($fullPath: ID!, $alertId: String) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
alertManagementAlerts(iid: $alertId) { alertManagementAlerts(iid: $alertId) {
nodes { nodes {
...AlertDetailItem ...AlertDetailItem
} }
}
} }
}
} }
#import "../fragments/list_item.fragment.graphql" #import "../fragments/list_item.fragment.graphql"
query getAlerts( query getAlerts(
$searchTerm: String, $searchTerm: String
$projectPath: ID!, $projectPath: ID!
$statuses: [AlertManagementStatus!], $statuses: [AlertManagementStatus!]
$sort: AlertManagementAlertSort, $sort: AlertManagementAlertSort
$firstPageSize: Int, $firstPageSize: Int
$lastPageSize: Int, $lastPageSize: Int
$prevPageCursor: String = "" $prevPageCursor: String = ""
$nextPageCursor: String = "" $nextPageCursor: String = ""
) { ) {
project(fullPath: $projectPath, ) { project(fullPath: $projectPath) {
alertManagementAlerts( alertManagementAlerts(
search: $searchTerm, search: $searchTerm
statuses: $statuses, statuses: $statuses
sort: $sort, sort: $sort
first: $firstPageSize first: $firstPageSize
last: $lastPageSize, last: $lastPageSize
after: $nextPageCursor, after: $nextPageCursor
before: $prevPageCursor before: $prevPageCursor
) { ) {
nodes { nodes {
...AlertListItem ...AlertListItem
}, }
pageInfo { pageInfo {
hasNextPage hasNextPage
endCursor endCursor
hasPreviousPage hasPreviousPage
startCursor startCursor
} }
}
} }
}
} }
query getAlertsCount( query getAlertsCount($searchTerm: String, $projectPath: ID!) {
$searchTerm: String, project(fullPath: $projectPath) {
$projectPath: ID! alertManagementAlertStatusCounts(search: $searchTerm) {
) { all
project(fullPath: $projectPath) { open
alertManagementAlertStatusCounts( acknowledged
search: $searchTerm resolved
) { triggered
all
open
acknowledged
resolved
triggered
}
} }
}
} }
query sidebarStatus { query sidebarStatus {
sidebarStatus @client sidebarStatus @client
} }
fragment BoardFragment on Board { fragment BoardFragment on Board {
id, id
name name
} }
fragment BoardListShared on BoardList { fragment BoardListShared on BoardList {
id, id
title, title
position, position
listType, listType
collapsed, collapsed
label { label {
id, id
title, title
color, color
textColor, textColor
description, description
descriptionHtml descriptionHtml
} }
} }
mutation updateActiveDiscussion($id: String, $source: String) { mutation updateActiveDiscussion($id: String, $source: String) {
updateActiveDiscussion (id: $id, source: $source ) @client updateActiveDiscussion(id: $id, source: $source) @client
} }
...@@ -11,7 +11,7 @@ mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) { ...@@ -11,7 +11,7 @@ mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) {
sha sha
} }
} }
}, }
} }
skippedDesigns { skippedDesigns {
filename filename
......
mutation updateActiveDiscussion($id: String, $source: String) { mutation updateActiveDiscussion($id: String, $source: String) {
updateActiveDiscussion (id: $id, source: $source ) @client updateActiveDiscussion(id: $id, source: $source) @client
} }
...@@ -11,7 +11,7 @@ mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) { ...@@ -11,7 +11,7 @@ mutation uploadDesign($files: [Upload!]!, $projectPath: ID!, $iid: ID!) {
sha sha
} }
} }
}, }
} }
skippedDesigns { skippedDesigns {
filename filename
......
query errorDetails($fullPath: ID!, $errorId: ID!) { query errorDetails($fullPath: ID!, $errorId: ID!) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
sentryErrors { sentryErrors {
detailedError(id: $errorId) { detailedError(id: $errorId) {
id id
sentryId sentryId
title title
userCount userCount
count count
status status
firstSeen firstSeen
lastSeen lastSeen
message message
culprit culprit
tags { tags {
level level
logger logger
}
externalUrl
externalBaseUrl
firstReleaseVersion
lastReleaseVersion
gitlabCommit
gitlabCommitPath
gitlabIssuePath
}
} }
externalUrl
externalBaseUrl
firstReleaseVersion
lastReleaseVersion
gitlabCommit
gitlabCommitPath
gitlabIssuePath
}
} }
}
} }
query getUserPermissions($projectPath: ID!) { query getUserPermissions($projectPath: ID!) {
project(fullPath: $projectPath) { project(fullPath: $projectPath) {
userPermissions { userPermissions {
createMergeRequestIn, createMergeRequestIn
readMergeRequest, readMergeRequest
pushCode pushCode
} }
} }
......
query ($fullPath: ID!, $iid: String!) { query($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) { project(fullPath: $fullPath) {
issue (iid: $iid) { issue(iid: $iid) {
iid iid
} }
} }
......
query ($fullPath: ID!, $iid: String!) { query($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) { project(fullPath: $fullPath) {
issue (iid: $iid) { issue(iid: $iid) {
iid iid
} }
} }
......
mutation DeleteSnippet($id: ID!) { mutation DeleteSnippet($id: ID!) {
destroySnippet(input: {id: $id}) { destroySnippet(input: { id: $id }) {
errors errors
} }
} }
\ No newline at end of file
...@@ -4,4 +4,4 @@ query CanCreateProjectSnippet($fullPath: ID!) { ...@@ -4,4 +4,4 @@ query CanCreateProjectSnippet($fullPath: ID!) {
createSnippet createSnippet
} }
} }
} }
\ No newline at end of file
...@@ -4,4 +4,4 @@ query CanCreatePersonalSnippet { ...@@ -4,4 +4,4 @@ query CanCreatePersonalSnippet {
createSnippet createSnippet
} }
} }
} }
\ No newline at end of file
mutation submitContentChanges($input: SubmitContentChangesInput) { mutation submitContentChanges($input: SubmitContentChangesInput) {
submitContentChanges(input: $input) @client { submitContentChanges(input: $input) @client {
branch branch
commit commit
mergeRequest mergeRequest
......
...@@ -3,7 +3,7 @@ query appData { ...@@ -3,7 +3,7 @@ query appData {
isSupportedContent isSupportedContent
project project
sourcePath sourcePath
username, username
returnUrl returnUrl
} }
} }
query sourceContent($project: ID!, $sourcePath: String!) { query sourceContent($project: ID!, $sourcePath: String!) {
project(fullPath: $project) { project(fullPath: $project) {
fullPath, fullPath
file(path: $sourcePath) @client { file(path: $sourcePath) @client {
title title
content content
......
---
title: Format graphql files with prettier
merge_request: 36244
author:
type: other
...@@ -94,13 +94,15 @@ When declaring multiple globals, always use one `/* global [name] */` line per v ...@@ -94,13 +94,15 @@ When declaring multiple globals, always use one `/* global [name] */` line per v
## Formatting with Prettier ## Formatting with Prettier
Our code is automatically formatted with [Prettier](https://prettier.io) to follow our style guides. Prettier is taking care of formatting `.js`, `.vue`, and `.scss` files based on the standard prettier rules. You can find all settings for Prettier in `.prettierrc`. > Support for `.graphql` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/227280) in GitLab 13.2.
Our code is automatically formatted with [Prettier](https://prettier.io) to follow our style guides. Prettier is taking care of formatting `.js`, `.vue`, `.graphql`, and `.scss` files based on the standard prettier rules. You can find all settings for Prettier in `.prettierrc`.
### Editor ### Editor
The easiest way to include prettier in your workflow is by setting up your preferred editor (all major editors are supported) accordingly. We suggest setting up prettier to run automatically when each file is saved. Find [here](https://prettier.io/docs/en/editors.html) the best way to set it up in your preferred editor. The easiest way to include prettier in your workflow is by setting up your preferred editor (all major editors are supported) accordingly. We suggest setting up prettier to run automatically when each file is saved. Find [here](https://prettier.io/docs/en/editors.html) the best way to set it up in your preferred editor.
Please take care that you only let Prettier format the same file types as the global Yarn script does (`.js`, `.vue`, and `.scss`). In VSCode by example you can easily exclude file formats in your settings file: Please take care that you only let Prettier format the same file types as the global Yarn script does (`.js`, `.vue`, `.graphql`, and `.scss`). In VSCode by example you can easily exclude file formats in your settings file:
```json ```json
"prettier.disableLanguages": [ "prettier.disableLanguages": [
...@@ -169,6 +171,9 @@ To select Prettier as a formatter, add the following properties to your User or ...@@ -169,6 +171,9 @@ To select Prettier as a formatter, add the following properties to your User or
}, },
"[vue]": { "[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[graphql]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
} }
} }
``` ```
...@@ -188,5 +193,8 @@ To automatically format your files with Prettier, add the following properties t ...@@ -188,5 +193,8 @@ To automatically format your files with Prettier, add the following properties t
"[vue]": { "[vue]": {
"editor.formatOnSave": true "editor.formatOnSave": true
}, },
"[graphql]": {
"editor.formatOnSave": true
},
} }
``` ```
fragment BoardFragment on Board { fragment BoardFragment on Board {
id, id
name, name
weight weight
} }
#import "~/boards/queries/board_list_shared.fragment.graphql" #import "~/boards/queries/board_list_shared.fragment.graphql"
fragment BoardListFragment on BoardList { fragment BoardListFragment on BoardList {
...BoardListShared, ...BoardListShared
maxIssueCount, maxIssueCount
assignee { assignee {
id, id
name, name
username, username
avatarUrl, avatarUrl
webUrl webUrl
}, }
milestone { milestone {
id, id
title, title
webPath, webPath
description description
} }
} }
...@@ -14,7 +14,7 @@ query groupEpicsEE($fullPath: ID!) { ...@@ -14,7 +14,7 @@ query groupEpicsEE($fullPath: ID!) {
openedIssues openedIssues
closedIssues closedIssues
} }
issues { issues {
nodes { nodes {
id id
iid iid
...@@ -44,7 +44,6 @@ query groupEpicsEE($fullPath: ID!) { ...@@ -44,7 +44,6 @@ query groupEpicsEE($fullPath: ID!) {
} }
} }
} }
} }
} }
} }
......
...@@ -4,8 +4,8 @@ query epicDetails($fullPath: ID!, $iid: ID!) { ...@@ -4,8 +4,8 @@ query epicDetails($fullPath: ID!, $iid: ID!) {
participants { participants {
edges { edges {
node { node {
name, name
avatarUrl, avatarUrl
webUrl webUrl
} }
} }
......
mutation createIteration($input: CreateIterationInput!) { mutation createIteration($input: CreateIterationInput!) {
createIteration(input: $input) { createIteration(input: $input) {
iteration { iteration {
title, title
description, description
startDate, startDate
dueDate, dueDate
webUrl webUrl
} }
errors errors
......
query getComingSoonIssues($projectPath:ID!, $labelNames:[String]) { query getComingSoonIssues($projectPath: ID!, $labelNames: [String]) {
project(fullPath:$projectPath) { project(fullPath: $projectPath) {
issues(state:opened, labelName:$labelNames) { issues(state: opened, labelName: $labelNames) {
nodes { nodes {
iid, iid
title, title
webUrl, webUrl
labels { labels {
nodes { nodes {
title, title
color color
} }
}, }
milestone { milestone {
title title
} }
......
...@@ -25,7 +25,9 @@ query groupEpics( ...@@ -25,7 +25,9 @@ query groupEpics(
edges { edges {
node { node {
...BaseEpic ...BaseEpic
parent { id } parent {
id
}
} }
} }
} }
......
mutation deleteProjectFromSecurityDashboard($id: ID!) { mutation deleteProjectFromSecurityDashboard($id: ID!) {
removeProjectFromSecurityDashboard(input: {id: $id}) { removeProjectFromSecurityDashboard(input: { id: $id }) {
errors errors
} }
} }
mutation ($id: ID!, $comment: String! ) { mutation($id: ID!, $comment: String!) {
dismissVulnerability(input: {id: $id, comment: $comment}) { dismissVulnerability(input: { id: $id, comment: $comment }) {
errors errors
vulnerability { vulnerability {
id id
......
...@@ -24,8 +24,8 @@ query group( ...@@ -24,8 +24,8 @@ query group(
reportType: $reportType reportType: $reportType
state: $state state: $state
projectId: $projectId projectId: $projectId
){ ) {
nodes{ nodes {
...Vulnerability ...Vulnerability
} }
pageInfo { pageInfo {
......
query groupVulnerabilityHistory( query groupVulnerabilityHistory($fullPath: ID!, $startDate: ISO8601Date!, $endDate: ISO8601Date!) {
$fullPath: ID!
$startDate: ISO8601Date!
$endDate: ISO8601Date!
) {
group(fullPath: $fullPath) { group(fullPath: $fullPath) {
vulnerabilitiesCountByDayAndSeverity(startDate: $startDate, endDate: $endDate) { vulnerabilitiesCountByDayAndSeverity(startDate: $startDate, endDate: $endDate) {
nodes { nodes {
......
fragment VulnerabilitySeveritiesCount on Project{ fragment VulnerabilitySeveritiesCount on Project {
vulnerabilitySeveritiesCount{ vulnerabilitySeveritiesCount {
critical critical
high high
info info
......
query groupIterations($fullPath: ID!, $title: String) { query groupIterations($fullPath: ID!, $title: String) {
group(fullPath: $fullPath) { group(fullPath: $fullPath) {
iterations (title: $title) { iterations(title: $title) {
nodes { nodes {
id id
title title
......
query issueSprint($fullPath: ID!, $iid: String!) { query issueSprint($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
issue (iid: $iid) { issue(iid: $iid) {
iteration { iteration {
id id
title title
......
mutation updateIssueConfidential($projectPath: ID!, $iid: String!, $iterationId: ID) { mutation updateIssueConfidential($projectPath: ID!, $iid: String!, $iterationId: ID) {
issueSetIteration(input: {projectPath: $projectPath, iid: $iid, iterationId: $iterationId}) { issueSetIteration(input: { projectPath: $projectPath, iid: $iid, iterationId: $iterationId }) {
errors errors
issue { issue {
iteration { iteration {
......
query ($fullPath: ID!, $iid: String!) { query($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) { project(fullPath: $fullPath) {
issue (iid: $iid) { issue(iid: $iid) {
iid iid
} }
} }
......
query ($fullPath: ID!, $iid: String!) { query($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) { project(fullPath: $fullPath) {
issue (iid: $iid) { issue(iid: $iid) {
healthStatus healthStatus
} }
} }
......
...@@ -11,13 +11,13 @@ query project( ...@@ -11,13 +11,13 @@ query project(
) { ) {
project(fullPath: $fullPath) { project(fullPath: $fullPath) {
vulnerabilities( vulnerabilities(
after:$after after: $after
first:$first first: $first
severity: $severity severity: $severity
reportType: $reportType reportType: $reportType
state: $state state: $state
){ ) {
nodes{ nodes {
...Vulnerability ...Vulnerability
} }
pageInfo { pageInfo {
......
...@@ -3,7 +3,7 @@ const prettier = require('prettier'); ...@@ -3,7 +3,7 @@ const prettier = require('prettier');
const fs = require('fs'); const fs = require('fs');
const { getStagedFiles } = require('./frontend_script_utils'); const { getStagedFiles } = require('./frontend_script_utils');
const matchExtensions = ['js', 'vue']; const matchExtensions = ['js', 'vue', 'graphql'];
// This will improve glob performance by excluding certain directories. // This will improve glob performance by excluding certain directories.
// The .prettierignore file will also be respected, but after the glob has executed. // The .prettierignore file will also be respected, but after the glob has executed.
......
# pulled from GraphiQL query # pulled from GraphiQL query
query IntrospectionQuery { query IntrospectionQuery {
__schema { __schema {
queryType { name } queryType {
mutationType { name } name
subscriptionType { name } }
mutationType {
name
}
subscriptionType {
name
}
types { types {
...FullType ...FullType
} }
...@@ -54,7 +60,9 @@ fragment FullType on __Type { ...@@ -54,7 +60,9 @@ fragment FullType on __Type {
fragment InputValue on __InputValue { fragment InputValue on __InputValue {
name name
description description
type { ...TypeRef } type {
...TypeRef
}
defaultValue defaultValue
} }
......
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