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 @@
/public/
/vendor/
/tmp/
doc/api/graphql/reference/gitlab_schema.graphql
# ignore stylesheets for now as this clashes with our linter
*.css
......
......@@ -16,5 +16,4 @@ fragment AlertDetailItem on AlertManagementAlert {
...AlertNote
}
}
}
mutation createAlertIssue($projectPath: ID!, $iid: String!) {
createAlertIssue(input: { iid: $iid, projectPath: $projectPath }) {
errors
issue {
iid
}
createAlertIssue(input: { iid: $iid, projectPath: $projectPath }) {
errors
issue {
iid
}
}
}
mutation toggleSidebarStatus {
toggleSidebarStatus @client
toggleSidebarStatus @client
}
......@@ -4,9 +4,9 @@ mutation updateAlertStatus($projectPath: ID!, $status: AlertManagementStatus!, $
updateAlertStatus(input: { iid: $iid, status: $status, projectPath: $projectPath }) {
errors
alert {
iid,
status,
endedAt,
iid
status
endedAt
notes {
nodes {
...AlertNote
......
#import "../fragments/detail_item.fragment.graphql"
query alertDetails($fullPath: ID!, $alertId: String) {
project(fullPath: $fullPath) {
alertManagementAlerts(iid: $alertId) {
nodes {
...AlertDetailItem
}
}
project(fullPath: $fullPath) {
alertManagementAlerts(iid: $alertId) {
nodes {
...AlertDetailItem
}
}
}
}
#import "../fragments/list_item.fragment.graphql"
query getAlerts(
$searchTerm: String,
$projectPath: ID!,
$statuses: [AlertManagementStatus!],
$sort: AlertManagementAlertSort,
$firstPageSize: Int,
$lastPageSize: Int,
$prevPageCursor: String = ""
$nextPageCursor: String = ""
$searchTerm: String
$projectPath: ID!
$statuses: [AlertManagementStatus!]
$sort: AlertManagementAlertSort
$firstPageSize: Int
$lastPageSize: Int
$prevPageCursor: String = ""
$nextPageCursor: String = ""
) {
project(fullPath: $projectPath, ) {
alertManagementAlerts(
search: $searchTerm,
statuses: $statuses,
sort: $sort,
first: $firstPageSize
last: $lastPageSize,
after: $nextPageCursor,
before: $prevPageCursor
) {
nodes {
...AlertListItem
},
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
project(fullPath: $projectPath) {
alertManagementAlerts(
search: $searchTerm
statuses: $statuses
sort: $sort
first: $firstPageSize
last: $lastPageSize
after: $nextPageCursor
before: $prevPageCursor
) {
nodes {
...AlertListItem
}
pageInfo {
hasNextPage
endCursor
hasPreviousPage
startCursor
}
}
}
}
query getAlertsCount(
$searchTerm: String,
$projectPath: ID!
) {
project(fullPath: $projectPath) {
alertManagementAlertStatusCounts(
search: $searchTerm
) {
all
open
acknowledged
resolved
triggered
}
query getAlertsCount($searchTerm: String, $projectPath: ID!) {
project(fullPath: $projectPath) {
alertManagementAlertStatusCounts(search: $searchTerm) {
all
open
acknowledged
resolved
triggered
}
}
}
fragment BoardListShared on BoardList {
id,
title,
position,
listType,
collapsed,
id
title
position
listType
collapsed
label {
id,
title,
color,
textColor,
description,
id
title
color
textColor
description
descriptionHtml
}
}
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!) {
sha
}
}
},
}
}
skippedDesigns {
filename
......
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!) {
sha
}
}
},
}
}
skippedDesigns {
filename
......
query errorDetails($fullPath: ID!, $errorId: ID!) {
project(fullPath: $fullPath) {
sentryErrors {
detailedError(id: $errorId) {
id
sentryId
title
userCount
count
status
firstSeen
lastSeen
message
culprit
tags {
level
logger
}
externalUrl
externalBaseUrl
firstReleaseVersion
lastReleaseVersion
gitlabCommit
gitlabCommitPath
gitlabIssuePath
}
project(fullPath: $fullPath) {
sentryErrors {
detailedError(id: $errorId) {
id
sentryId
title
userCount
count
status
firstSeen
lastSeen
message
culprit
tags {
level
logger
}
externalUrl
externalBaseUrl
firstReleaseVersion
lastReleaseVersion
gitlabCommit
gitlabCommitPath
gitlabIssuePath
}
}
}
}
query getUserPermissions($projectPath: ID!) {
project(fullPath: $projectPath) {
userPermissions {
createMergeRequestIn,
readMergeRequest,
createMergeRequestIn
readMergeRequest
pushCode
}
}
......
query ($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) {
issue (iid: $iid) {
query($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue(iid: $iid) {
iid
}
}
......
query ($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) {
issue (iid: $iid) {
query($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue(iid: $iid) {
iid
}
}
......
mutation DeleteSnippet($id: ID!) {
destroySnippet(input: {id: $id}) {
destroySnippet(input: { id: $id }) {
errors
}
}
\ No newline at end of file
}
......@@ -4,4 +4,4 @@ query CanCreateProjectSnippet($fullPath: ID!) {
createSnippet
}
}
}
\ No newline at end of file
}
......@@ -4,4 +4,4 @@ query CanCreatePersonalSnippet {
createSnippet
}
}
}
\ No newline at end of file
}
mutation submitContentChanges($input: SubmitContentChangesInput) {
submitContentChanges(input: $input) @client {
submitContentChanges(input: $input) @client {
branch
commit
mergeRequest
......
......@@ -3,7 +3,7 @@ query appData {
isSupportedContent
project
sourcePath
username,
username
returnUrl
}
}
query sourceContent($project: ID!, $sourcePath: String!) {
project(fullPath: $project) {
fullPath,
fullPath
file(path: $sourcePath) @client {
title
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
## 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
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
"prettier.disableLanguages": [
......@@ -169,6 +171,9 @@ To select Prettier as a formatter, add the following properties to your User or
},
"[vue]": {
"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
"[vue]": {
"editor.formatOnSave": true
},
"[graphql]": {
"editor.formatOnSave": true
},
}
```
fragment BoardFragment on Board {
id,
name,
id
name
weight
}
#import "~/boards/queries/board_list_shared.fragment.graphql"
fragment BoardListFragment on BoardList {
...BoardListShared,
maxIssueCount,
...BoardListShared
maxIssueCount
assignee {
id,
name,
username,
avatarUrl,
id
name
username
avatarUrl
webUrl
},
}
milestone {
id,
title,
webPath,
id
title
webPath
description
}
}
......@@ -14,7 +14,7 @@ query groupEpicsEE($fullPath: ID!) {
openedIssues
closedIssues
}
issues {
issues {
nodes {
id
iid
......@@ -44,7 +44,6 @@ query groupEpicsEE($fullPath: ID!) {
}
}
}
}
}
}
......
......@@ -4,8 +4,8 @@ query epicDetails($fullPath: ID!, $iid: ID!) {
participants {
edges {
node {
name,
avatarUrl,
name
avatarUrl
webUrl
}
}
......
mutation createIteration($input: CreateIterationInput!) {
createIteration(input: $input) {
iteration {
title,
description,
startDate,
dueDate,
title
description
startDate
dueDate
webUrl
}
errors
......
query getComingSoonIssues($projectPath:ID!, $labelNames:[String]) {
project(fullPath:$projectPath) {
issues(state:opened, labelName:$labelNames) {
query getComingSoonIssues($projectPath: ID!, $labelNames: [String]) {
project(fullPath: $projectPath) {
issues(state: opened, labelName: $labelNames) {
nodes {
iid,
title,
webUrl,
iid
title
webUrl
labels {
nodes {
title,
title
color
}
},
}
milestone {
title
}
......
......@@ -25,7 +25,9 @@ query groupEpics(
edges {
node {
...BaseEpic
parent { id }
parent {
id
}
}
}
}
......
mutation deleteProjectFromSecurityDashboard($id: ID!) {
removeProjectFromSecurityDashboard(input: {id: $id}) {
removeProjectFromSecurityDashboard(input: { id: $id }) {
errors
}
}
mutation ($id: ID!, $comment: String! ) {
dismissVulnerability(input: {id: $id, comment: $comment}) {
mutation($id: ID!, $comment: String!) {
dismissVulnerability(input: { id: $id, comment: $comment }) {
errors
vulnerability {
id
......
......@@ -24,8 +24,8 @@ query group(
reportType: $reportType
state: $state
projectId: $projectId
){
nodes{
) {
nodes {
...Vulnerability
}
pageInfo {
......
query groupVulnerabilityHistory(
$fullPath: ID!
$startDate: ISO8601Date!
$endDate: ISO8601Date!
) {
query groupVulnerabilityHistory($fullPath: ID!, $startDate: ISO8601Date!, $endDate: ISO8601Date!) {
group(fullPath: $fullPath) {
vulnerabilitiesCountByDayAndSeverity(startDate: $startDate, endDate: $endDate) {
nodes {
......
fragment VulnerabilitySeveritiesCount on Project{
vulnerabilitySeveritiesCount{
fragment VulnerabilitySeveritiesCount on Project {
vulnerabilitySeveritiesCount {
critical
high
info
......
query groupIterations($fullPath: ID!, $title: String) {
group(fullPath: $fullPath) {
iterations (title: $title) {
iterations(title: $title) {
nodes {
id
title
......
query issueSprint($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue (iid: $iid) {
issue(iid: $iid) {
iteration {
id
title
......
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
issue {
iteration {
......
query ($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) {
issue (iid: $iid) {
query($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue(iid: $iid) {
iid
}
}
......
query ($fullPath: ID!, $iid: String!) {
project (fullPath: $fullPath) {
issue (iid: $iid) {
query($fullPath: ID!, $iid: String!) {
project(fullPath: $fullPath) {
issue(iid: $iid) {
healthStatus
}
}
......
......@@ -11,13 +11,13 @@ query project(
) {
project(fullPath: $fullPath) {
vulnerabilities(
after:$after
first:$first
after: $after
first: $first
severity: $severity
reportType: $reportType
state: $state
){
nodes{
) {
nodes {
...Vulnerability
}
pageInfo {
......
......@@ -3,7 +3,7 @@ const prettier = require('prettier');
const fs = require('fs');
const { getStagedFiles } = require('./frontend_script_utils');
const matchExtensions = ['js', 'vue'];
const matchExtensions = ['js', 'vue', 'graphql'];
// This will improve glob performance by excluding certain directories.
// The .prettierignore file will also be respected, but after the glob has executed.
......
# pulled from GraphiQL query
query IntrospectionQuery {
__schema {
queryType { name }
mutationType { name }
subscriptionType { name }
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullType
}
......@@ -54,7 +60,9 @@ fragment FullType on __Type {
fragment InputValue on __InputValue {
name
description
type { ...TypeRef }
type {
...TypeRef
}
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