Skip to content

Commit cc86c34

Browse files
authored
refactor: use dprint instead of prettier (#677)
1 parent 2a121c6 commit cc86c34

32 files changed

+322
-211
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@
22
"root": true,
33
"extends": ["prisma"],
44
"overrides": [],
5-
"rules": {}
5+
"rules": {
6+
"simple-import-sort/imports": "off"
7+
}
68
}

.vscode/extensions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "orta.vscode-twoslash-queries"]
2+
"recommendations": [
3+
"dprint.dprint",
4+
"dbaeumer.vscode-eslint",
5+
"orta.vscode-twoslash-queries"
6+
]
37
}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ npm add graphql-request graphql
4747
Send a GraphQL document using a static request function:
4848

4949
```js
50-
import { request, gql } from 'graphql-request'
50+
import { gql, request } from 'graphql-request'
5151

5252
const document = gql`
5353
{
@@ -73,7 +73,7 @@ await request({
7373
A class is available for constructing your own instances:
7474

7575
```js
76-
import { GraphQLClient, gql } from 'graphql-request'
76+
import { gql, GraphQLClient } from 'graphql-request'
7777

7878
const document = gql`
7979
{
@@ -185,7 +185,7 @@ In [this issue](https://github.com/jasonkuhrt/graphql-request/issues/500) we dec
185185

186186
#### Do I need to wrap my GraphQL documents inside the `gql` template exported by `graphql-request`?
187187

188-
No. It is there for convenience so that you can get the tooling support like prettier formatting and IDE syntax highlighting. You can use `gql` from `graphql-tag` if you need it for some reason too.
188+
No. It is there for convenience so that you can get the tooling support like automatic formatting and syntax highlighting. You can use `gql` from `graphql-tag` if you need it for some reason too.
189189

190190
#### What sets `graphql-request` apart from other clients like Apollo, Relay, etc.?
191191

dprint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"typescript": {
3+
"quoteStyle": "preferSingle",
4+
"semiColons": "asi"
5+
},
6+
"json": {
7+
},
8+
"markdown": {
9+
},
10+
"excludes": [
11+
"**/node_modules",
12+
"**/*-lock.json"
13+
],
14+
"plugins": [
15+
"https://plugins.dprint.dev/typescript-0.89.1.wasm",
16+
"https://plugins.dprint.dev/json-0.19.1.wasm",
17+
"https://plugins.dprint.dev/markdown-0.16.3.wasm"
18+
]
19+
}

examples/configuration-fetch-custom-function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { gql, GraphQLClient } from '../src/entrypoints/main.js'
21
import fetchCookie from 'fetch-cookie'
2+
import { gql, GraphQLClient } from '../src/entrypoints/main.js'
33

44
const endpoint = `https://api.graph.cool/simple/v1/cixos23120m0n0173veiiwrjr`
55

examples/configuration-request-json-serializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* An original use case for this feature is `BigInt` support:
44
*/
55

6-
import { gql, GraphQLClient } from '../src/entrypoints/main.js'
76
import JSONbig from 'json-bigint'
7+
import { gql, GraphQLClient } from '../src/entrypoints/main.js'
88

99
const jsonSerializer = JSONbig({ useNativeBigInt: true })
1010
const graphQLClient = new GraphQLClient(`https://some-api`, { jsonSerializer })

examples/typescript-typed-document-node.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { gql, GraphQLClient, request } from '../src/entrypoints/main.js'
21
import type { TypedDocumentNode } from '@graphql-typed-document-node/core'
32
import { parse } from 'graphql'
3+
import { gql, GraphQLClient, request } from '../src/entrypoints/main.js'
44

55
{
66
const endpoint = `https://graphql-yoga.com/api/graphql`

package.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
"homepage": "https://github.com/jasonkuhrt/graphql-request",
3838
"scripts": {
3939
"dev": "rm -rf dist && tsc --watch",
40-
"format": "pnpm build:docs && prettier --write .",
40+
"format": "pnpm build:docs && dprint fmt",
4141
"lint": "eslint . --ext .ts,.tsx --fix",
4242
"check": "pnpm check:types && pnpm check:format && pnpm check:lint",
4343
"check:types": "pnpm tsc --noEmit",
44-
"check:format": "prettier --check . && pnpm build:docs && git diff --exit-code README.md",
44+
"check:format": "dprint check && pnpm build:docs && git diff --exit-code README.md",
4545
"check:lint": "eslint . --ext .ts,.tsx --max-warnings 0",
4646
"prepublishOnly": "pnpm build",
47-
"build:docs": "doctoc README.md --notitle && prettier --write README.md",
47+
"build:docs": "doctoc README.md --notitle && dprint fmt README.md",
4848
"build": "pnpm clean && pnpm tsc --project tsconfig.build.json",
4949
"clean": "tsc --build --clean && rm -rf build",
5050
"test": "vitest",
@@ -54,14 +54,14 @@
5454
"release:pr": "dripip pr"
5555
},
5656
"dependencies": {
57-
"@graphql-typed-document-node/core": "^3.2.0"
57+
"@graphql-typed-document-node/core": "^3.2.0",
58+
"dprint": "^0.45.0"
5859
},
5960
"peerDependencies": {
6061
"graphql": "14 - 16"
6162
},
6263
"devDependencies": {
6364
"@graphql-tools/schema": "^10.0.2",
64-
"@prisma-labs/prettier-config": "^0.1.0",
6565
"@tsconfig/node16": "^16.1.1",
6666
"@types/body-parser": "^1.19.5",
6767
"@types/express": "^4.17.21",
@@ -75,7 +75,6 @@
7575
"doctoc": "^2.2.1",
7676
"dripip": "^0.10.0",
7777
"eslint": "^8.56.0",
78-
"eslint-config-prettier": "^9.1.0",
7978
"eslint-config-prisma": "^0.2.0",
8079
"eslint-plugin-deprecation": "^2.0.0",
8180
"eslint-plugin-only-warn": "^1.1.0",
@@ -90,12 +89,10 @@
9089
"graphql-ws": "^5.14.3",
9190
"happy-dom": "^13.3.1",
9291
"json-bigint": "^1.0.0",
93-
"prettier": "^3.2.4",
9492
"tsx": "^4.7.0",
9593
"type-fest": "^4.10.1",
9694
"typescript": "^5.3.3",
9795
"vitest": "^1.2.1",
9896
"ws": "^8.16.0"
99-
},
100-
"prettier": "@prisma-labs/prettier-config"
97+
}
10198
}

pnpm-lock.yaml

Lines changed: 73 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/legacy/classes/ClientError.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ export class ClientError extends Error {
55
public request: GraphQLRequestContext
66

77
constructor(response: GraphQLResponse, request: GraphQLRequestContext) {
8-
const message = `${ClientError.extractMessage(response)}: ${JSON.stringify({
9-
response,
10-
request,
11-
})}`
8+
const message = `${ClientError.extractMessage(response)}: ${
9+
JSON.stringify({
10+
response,
11+
request,
12+
})
13+
}`
1214

1315
super(message)
1416

0 commit comments

Comments
 (0)