Skip to content

Commit 2788738

Browse files
committed
chore: update prettier (#230)
1 parent 5b7b734 commit 2788738

File tree

8 files changed

+220
-923
lines changed

8 files changed

+220
-923
lines changed

.prettierrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "always",
3+
"experimentalTernaries": true,
4+
"printWidth": 110,
5+
"singleQuote": true,
6+
"trailingComma": "all"
7+
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"build": "bash ./build",
1616
"prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1",
1717
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
18-
"format": "prettier --write --cache --cache-strategy metadata . !dist",
18+
"format": "prettier --write --cache --cache-strategy metadata . !dist",
1919
"prepare": "if [ $(basename $(dirname $PWD)) = 'node_modules' ]; then npm run build; fi",
2020
"tsn": "ts-node -r tsconfig-paths/register",
2121
"lint": "eslint --ext ts,js .",
@@ -37,10 +37,10 @@
3737
"@typescript-eslint/eslint-plugin": "^6.7.0",
3838
"@typescript-eslint/parser": "^6.7.0",
3939
"eslint": "^8.49.0",
40-
"eslint-plugin-prettier": "^4.0.0",
40+
"eslint-plugin-prettier": "^5.0.0",
4141
"eslint-plugin-unused-imports": "^2.0.0",
4242
"jest": "^29.4.0",
43-
"prettier": "rattrayalex/prettier#postfix-ternaries",
43+
"prettier": "^3.0.0",
4444
"ts-jest": "^29.1.0",
4545
"ts-morph": "^19.0.0",
4646
"ts-node": "^10.5.0",

src/error.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export class APIError extends AnthropicError {
2424
private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
2525
const msg =
2626
error?.message ?
27-
typeof error.message === 'string' ? error.message
27+
typeof error.message === 'string' ?
28+
error.message
2829
: JSON.stringify(error.message)
2930
: error ? JSON.stringify(error)
3031
: message;

src/streaming.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ type ServerSentEvent = {
1515
export class Stream<Item> implements AsyncIterable<Item> {
1616
controller: AbortController;
1717

18-
constructor(private iterator: () => AsyncIterator<Item>, controller: AbortController) {
18+
constructor(
19+
private iterator: () => AsyncIterator<Item>,
20+
controller: AbortController,
21+
) {
1922
this.controller = controller;
2023
}
2124

src/uploads.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
146146
}
147147
} else {
148148
throw new Error(
149-
`Unexpected data type: ${typeof value}; constructor: ${
150-
value?.constructor?.name
151-
}; props: ${propsForError(value)}`,
149+
`Unexpected data type: ${typeof value}; constructor: ${value?.constructor
150+
?.name}; props: ${propsForError(value)}`,
152151
);
153152
}
154153

tests/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ describe('retries', () => {
200200
let count = 0;
201201
const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise<Response> => {
202202
if (!count++)
203-
return new Promise((resolve, reject) =>
204-
signal?.addEventListener('abort', () => reject(new Error('timed out'))),
203+
return new Promise(
204+
(resolve, reject) => signal?.addEventListener('abort', () => reject(new Error('timed out'))),
205205
);
206206
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
207207
};

yarn.lock

Lines changed: 200 additions & 907 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)