Skip to content

Commit ca8dc52

Browse files
author
Dimitri POSTOLOV
authored
Add Prettier Check GitHub action (#3838)
* add `.prettierignore` to ignore invalid test fixtures * prettify javascript/typescript files * prettify graphql files * prettify md,mdx,json,yml files * add prettier-check github action * fix tests on ci
1 parent 83b304c commit ca8dc52

File tree

281 files changed

+10308
-8140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+10308
-8140
lines changed

.changeset/config.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
"access": "public",
77
"baseBranch": "master",
88
"updateInternalDependencies": "patch",
9-
"ignore": [
10-
"@graphql-tools/website"
11-
]
9+
"ignore": ["@graphql-tools/website"]
1210
}

.eslintrc.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
"parserOptions": {
44
"project": "./tsconfig.json"
55
},
6-
"extends": [
7-
"eslint:recommended",
8-
"standard",
9-
"prettier",
10-
"plugin:@typescript-eslint/recommended"
11-
],
6+
"extends": ["eslint:recommended", "standard", "prettier", "plugin:@typescript-eslint/recommended"],
127
"plugins": ["@typescript-eslint"],
138
"rules": {
149
"no-empty": "off",
@@ -35,18 +30,15 @@
3530
"@typescript-eslint/interface-name-prefix": "off",
3631
"@typescript-eslint/explicit-module-boundary-types": "off",
3732
"default-param-last": "off",
38-
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.ts", "**/*.spec.ts"]}]
33+
"import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/*.test.ts", "**/*.spec.ts"] }]
3934
},
4035
"env": {
4136
"es6": true,
4237
"node": true
4338
},
4439
"overrides": [
4540
{
46-
"files": [
47-
"**/{test,tests,testing}/**/*.{ts,js}",
48-
"*.{spec,test}.{ts,js}"
49-
],
41+
"files": ["**/{test,tests,testing}/**/*.{ts,js}", "*.{spec,test}.{ts,js}"],
5042
"env": {
5143
"jest": true
5244
},
@@ -65,7 +57,7 @@
6557
"packages/loaders/code-file/tests/test-files",
6658
"packages/loaders/git/tests/test-files"
6759
],
68-
"globals":{
60+
"globals": {
6961
"BigInt": true
7062
}
7163
}

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ about: Create a bug report to help us improve
44
---
55

66
**Describe the bug**
7+
78
<!-- A clear and concise description of what the bug is. -->
89

910
**To Reproduce**
@@ -12,6 +13,7 @@ Steps to reproduce the behavior:
1213
<!-- Adding a codesandbox can help us understand the bug better and speed up things -->
1314

1415
**Expected behavior**
16+
1517
<!-- A clear and concise description of what you expected to happen. -->
1618

1719
**Environment:**
@@ -21,4 +23,5 @@ Steps to reproduce the behavior:
2123
- NodeJS:
2224

2325
**Additional context**
26+
2427
<!-- Add any other context about the problem here. -->
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
22
name: Feature Request
33
about: Suggest an idea for the core of this project
4-
54
---
65

76
**Is your feature request related to a problem? Please describe.**
87

98
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
109

1110
**Describe the solution you'd like**
11+
1212
<!-- A clear and concise description of what you want to happen. -->
1313

1414
**Describe alternatives you've considered**
15+
1516
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
1617

1718
**Additional context**
19+
1820
<!-- Add any other context or screenshots about the feature request here. -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
🚨 **IMPORTANT: Please do not create a Pull Request without creating an issue first.**
99

10-
*Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.*
10+
_Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request._
1111

1212
## Description
1313

1414
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
1515

1616
Related # (issue)
17+
1718
<!--
1819
Please do not use "Fixed" or "Resolves". Keep "Related" as-is.
1920
-->
@@ -39,6 +40,7 @@ Please describe the tests that you ran to verify your changes. Provide instructi
3940
- [ ] Test B
4041

4142
**Test Environment**:
43+
4244
- OS:
4345
- `@graphql-tools/...`:
4446
- NodeJS:

.github/workflows/codeql-analysis.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: 'CodeQL'
1313

1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [master]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [master]
2020

2121
jobs:
2222
analyze:
@@ -30,40 +30,40 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
language: [ 'javascript' ]
33+
language: ['javascript']
3434
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3535
# Learn more:
3636
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
3737

3838
steps:
39-
- name: Checkout repository
40-
uses: actions/checkout@v2
39+
- name: Checkout repository
40+
uses: actions/checkout@v2
4141

42-
# Initializes the CodeQL tools for scanning.
43-
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v1
45-
with:
46-
languages: ${{ matrix.language }}
47-
# If you wish to specify custom queries, you can do so here or in a config file.
48-
# By default, queries listed here will override any specified in a config file.
49-
# Prefix the list here with "+" to use these queries and those in the config file.
50-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
42+
# Initializes the CodeQL tools for scanning.
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v1
45+
with:
46+
languages: ${{ matrix.language }}
47+
# If you wish to specify custom queries, you can do so here or in a config file.
48+
# By default, queries listed here will override any specified in a config file.
49+
# Prefix the list here with "+" to use these queries and those in the config file.
50+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5151

52-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53-
# If this step fails, then you should remove it and run the build manually (see below)
54-
- name: Autobuild
55-
uses: github/codeql-action/autobuild@v1
52+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53+
# If this step fails, then you should remove it and run the build manually (see below)
54+
- name: Autobuild
55+
uses: github/codeql-action/autobuild@v1
5656

57-
# ℹ️ Command-line programs to run using the OS shell.
58-
# 📚 https://git.io/JvXDl
57+
# ℹ️ Command-line programs to run using the OS shell.
58+
# 📚 https://git.io/JvXDl
5959

60-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
61-
# and modify them (or add more) to build your code if your project
62-
# uses a compiled language
60+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
61+
# and modify them (or add more) to build your code if your project
62+
# uses a compiled language
6363

64-
#- run: |
65-
# make bootstrap
66-
# make release
64+
#- run: |
65+
# make bootstrap
66+
# make release
6767

68-
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v1
68+
- name: Perform CodeQL Analysis
69+
uses: github/codeql-action/analyze@v1

.github/workflows/tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ on:
77
pull_request: {}
88

99
jobs:
10+
prettier-check:
11+
name: 🧹 Prettier Check
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Master
15+
uses: actions/checkout@v2
16+
- name: Use Node
17+
uses: actions/setup-node@master
18+
with:
19+
node-version: 17
20+
- name: Cache Yarn
21+
uses: actions/cache@v2
22+
with:
23+
path: '**/node_modules'
24+
key: ${{runner.os}}-17-16-yarn-${{hashFiles('yarn.lock')}}
25+
restore-keys: |
26+
${{runner.os}}-17-16-yarn
27+
- name: Install Dependencies using Yarn
28+
run: yarn install --ignore-engines && git checkout yarn.lock
29+
- name: Prettier Check
30+
run: yarn prettier:check
1031
lint:
1132
name: Lint
1233
runs-on: ubuntu-latest

.prettierignore

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
dist
2-
tests
3-
tests
4-
spec
2+
packages/import/tests/schema/fixtures/import-duplicate/all.graphql
3+
packages/import/tests/schema/fixtures/imports-only/all.graphql
4+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/1/index.graphql
5+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/2/index.graphql
6+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/3/index.graphql
7+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/4/index.graphql
8+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/5/index.graphql
9+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/6/index.graphql
10+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/7/index.graphql
11+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/8/index.graphql
12+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/9/index.graphql
13+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/10/index.graphql
14+
packages/import/tests/schema/fixtures/multiple-directories-with-master-schema/index.graphql
15+
packages/import/tests/schema/fixtures/multiple-imports/schema.graphql
16+
packages/import/tests/schema/fixtures/multiple-levels-master-schema/level1.graphql
17+
packages/load/tests/loaders/documents/test-invalid-syntax/invalid-syntax.query.graphql
18+
packages/load/tests/loaders/schema/test-files/error.ts
19+
packages/load/tests/loaders/schema/test-files/schema-dir/invalid.graphql
20+
packages/loaders/git/tests/test-files/type-defs-invalid.graphql
21+
packages/loaders/json-file/tests/test-files/failing/malformed.json

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Here are some ways to contribute to the project, from easiest to most difficult:
44

5-
* [Reporting bugs](#reporting-bugs)
6-
* [Improving the documentation](#improving-the-documentation)
7-
* [Responding to issues](#responding-to-issues)
8-
* [Small bug fixes](#small-bug-fixes)
9-
* [Suggesting features](#suggesting-features)
10-
* [Big pull requests](#big-prs)
5+
- [Reporting bugs](#reporting-bugs)
6+
- [Improving the documentation](#improving-the-documentation)
7+
- [Responding to issues](#responding-to-issues)
8+
- [Small bug fixes](#small-bug-fixes)
9+
- [Suggesting features](#suggesting-features)
10+
- [Big pull requests](#big-prs)
1111

1212
## Issues
1313

README.md

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ This package provides a few useful ways to create a GraphQL schema:
1313

1414
1. Use the GraphQL schema language to [generate a schema](https://graphql-tools.com/docs/generate-schema) with full support for resolvers, interfaces, unions, and custom scalars. The schema produced is completely compatible with [GraphQL.js](https://github.com/graphql/graphql-js).
1515
2. [Mock your GraphQL API](https://graphql-tools.com/docs/mocking) with fine-grained per-type mocking
16-
3. Automatically [stitch multiple schemas together](https://www.graphql-tools.com/docs/stitch-combining-schemas
17-
) into one larger API
16+
3. Automatically [stitch multiple schemas together](https://www.graphql-tools.com/docs/stitch-combining-schemas) into one larger API
1817

1918
## Documentation
2019

@@ -31,43 +30,40 @@ You can develop your JavaScript based GraphQL API with `graphql-tools` and `expr
3130
When using `graphql-tools`, you describe the schema as a GraphQL type language string:
3231

3332
```js
34-
35-
const typeDefs = /* GraphQL */`
36-
type Author {
37-
id: ID! # the ! means that every author object _must_ have an id
38-
firstName: String
39-
lastName: String
40-
"""
41-
the list of Posts by this author
42-
"""
43-
posts: [Post]
44-
}
45-
46-
type Post {
47-
id: ID!
48-
title: String
49-
author: Author
50-
votes: Int
51-
}
52-
53-
# the schema allows the following query:
54-
type Query {
55-
posts: [Post]
56-
}
57-
58-
# this schema allows the following mutation:
59-
type Mutation {
60-
upvotePost (
61-
postId: ID!
62-
): Post
63-
}
64-
65-
# we need to tell the server which types represent the root query
66-
# and root mutation types. We call them RootQuery and RootMutation by convention.
67-
schema {
68-
query: Query
69-
mutation: Mutation
70-
}
33+
const typeDefs = /* GraphQL */ `
34+
type Author {
35+
id: ID! # the ! means that every author object _must_ have an id
36+
firstName: String
37+
lastName: String
38+
"""
39+
the list of Posts by this author
40+
"""
41+
posts: [Post]
42+
}
43+
44+
type Post {
45+
id: ID!
46+
title: String
47+
author: Author
48+
votes: Int
49+
}
50+
51+
# the schema allows the following query:
52+
type Query {
53+
posts: [Post]
54+
}
55+
56+
# this schema allows the following mutation:
57+
type Mutation {
58+
upvotePost(postId: ID!): Post
59+
}
60+
61+
# we need to tell the server which types represent the root query
62+
# and root mutation types. We call them RootQuery and RootMutation by convention.
63+
schema {
64+
query: Query
65+
mutation: Mutation
66+
}
7167
`;
7268

7369
export default typeDefs;
@@ -126,10 +122,13 @@ var express = require('express');
126122
var { graphqlHTTP } = require('express-graphql');
127123

128124
var app = express();
129-
app.use('/graphql', graphqlHTTP({
130-
schema: executableSchema,
131-
graphiql: true,
132-
}));
125+
app.use(
126+
'/graphql',
127+
graphqlHTTP({
128+
schema: executableSchema,
129+
graphiql: true,
130+
})
131+
);
133132
app.listen(4000);
134133
console.log('Running a GraphQL API server at http://localhost:4000/graphql');
135134
```

0 commit comments

Comments
 (0)