Skip to content

Commit

Permalink
chore: update prettier (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Dec 19, 2023
1 parent 5b7b734 commit 2788738
Show file tree
Hide file tree
Showing 8 changed files with 220 additions and 923 deletions.
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"arrowParens": "always",
"experimentalTernaries": true,
"printWidth": 110,
"singleQuote": true,
"trailingComma": "all"
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"build": "bash ./build",
"prepack": "echo 'to pack, run yarn build && (cd dist; yarn pack)' && exit 1",
"prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"format": "prettier --write --cache --cache-strategy metadata . !dist",
"prepare": "if [ $(basename $(dirname $PWD)) = 'node_modules' ]; then npm run build; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "eslint --ext ts,js .",
Expand All @@ -37,10 +37,10 @@
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"eslint": "^8.49.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.4.0",
"prettier": "rattrayalex/prettier#postfix-ternaries",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"ts-morph": "^19.0.0",
"ts-node": "^10.5.0",
Expand Down
3 changes: 2 additions & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class APIError extends AnthropicError {
private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
const msg =
error?.message ?
typeof error.message === 'string' ? error.message
typeof error.message === 'string' ?
error.message
: JSON.stringify(error.message)
: error ? JSON.stringify(error)
: message;
Expand Down
5 changes: 4 additions & 1 deletion src/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ type ServerSentEvent = {
export class Stream<Item> implements AsyncIterable<Item> {
controller: AbortController;

constructor(private iterator: () => AsyncIterator<Item>, controller: AbortController) {
constructor(
private iterator: () => AsyncIterator<Item>,
controller: AbortController,
) {
this.controller = controller;
}

Expand Down
5 changes: 2 additions & 3 deletions src/uploads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,8 @@ async function getBytes(value: ToFileInput): Promise<Array<BlobPart>> {
}
} else {
throw new Error(
`Unexpected data type: ${typeof value}; constructor: ${
value?.constructor?.name
}; props: ${propsForError(value)}`,
`Unexpected data type: ${typeof value}; constructor: ${value?.constructor
?.name}; props: ${propsForError(value)}`,
);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ describe('retries', () => {
let count = 0;
const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise<Response> => {
if (!count++)
return new Promise((resolve, reject) =>
signal?.addEventListener('abort', () => reject(new Error('timed out'))),
return new Promise(
(resolve, reject) => signal?.addEventListener('abort', () => reject(new Error('timed out'))),
);
return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
};
Expand Down
1,107 changes: 200 additions & 907 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 2788738

Please sign in to comment.