Skip to content

Commit

Permalink
chore: update prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
sroussey committed Jan 31, 2025
1 parent 1e645d5 commit 015bd97
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 30 deletions.
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "always"
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"search.exclude": {
"**/dist": true,
"**/package-lock.json": true,
"**/bun.lock": true,
"**/*.tsbuildinfo": true
},
"editor.codeActionsOnSave": {
Expand Down
3 changes: 3 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-regexp": "^2.7.0",
"globals": "^15.14.0",
"prettier": "^3.4.2",
"typescript": "^5.7.3",
},
},
Expand Down Expand Up @@ -1115,6 +1116,8 @@

"prelude-ls": ["[email protected]", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],

"prettier": ["[email protected]", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ=="],

"process": ["[email protected]", "", {}, "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A=="],

"prop-types": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="],
Expand Down
2 changes: 1 addition & 1 deletion examples/web/src/RunGraphFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function listenToTask(
extent: "parent",
selectable: false,
connectable: false,
} as Node<TurboNodeData>)
}) as Node<TurboNodeData>
);
listenToGraphTasks(task.subGraph, setNodes, setEdges);
let returnNodes = nodes.filter((n) => n.parentId !== task.config.id); // remove old children
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"clean": "rm -rf node_modules packages/*/node_modules packages/*/dist packages/*/src/**/*\\.d\\.ts packages/*/src/**/*\\.map examples/*/node_modules examples/*/dist examples/*/src/**/*\\.d\\.ts examples/*/src/**/*\\.map",
"watch:packages": "concurrently --kill-others -c 'auto' -n core,task,storage,ai,provider,test 'cd packages/core && bun run watch' 'sleep 3 && cd packages/task && bun run watch' 'sleep 3 && cd packages/storage && bun run watch' 'sleep 3 && cd packages/ai && bun run watch' 'sleep 6 && cd packages/ai-provider && bun run watch' 'sleep 10 && cd packages/test && bun run watch'",
"docs": "typedoc",
"format": "eslint --fix && prettier \"{packages|examples}/*/src/**/*.{js,ts,tsx,json}\" --check --write",
"format": "eslint --fix && prettier \"{packages,examples}/*/src/**/*.{js,ts,tsx,json}\" --check --write",
"release": "bun run build && bun publish",
"test": "jest"
},
Expand Down Expand Up @@ -57,6 +57,7 @@
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-regexp": "^2.7.0",
"globals": "^15.14.0",
"prettier": "^3.4.2",
"typescript": "^5.7.3"
},
"engines": {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/job/base/JobQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { ILimiter } from "./ILimiter";
import { Job, JobStatus } from "./Job";

export class RetryError extends Error {
constructor(public retryDate: Date, message: string) {
constructor(
public retryDate: Date,
message: string
) {
super(message);
this.name = "RetryError";
}
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/source/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ export class Document {
}

export class DocumentSection extends Document {
constructor(public parent: Document, content?: ContentType, metadata?: DocumentSectionMetadata) {
constructor(
public parent: Document,
content?: ContentType,
metadata?: DocumentSectionMetadata
) {
super(content, metadata);
this.parent = parent;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/storage/base/KVRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export abstract class KVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Record<string, any> = Key & Value
Combined extends Record<string, any> = Key & Value,
> {
// KV repository event emitter
private events = new EventEmitter<KVEvents>();
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/task/base/ArrayTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ function generateCombinations<T extends TaskInput>(input: T, inputMakeArray: (ke
// Move to the next combination of indices
for (let i = indices.length - 1; i >= 0; i--) {
if (++indices[i] < arraysToCombine[i].length) break; // Increment current index if possible
if (i === 0) done = true; // All combinations have been generated
if (i === 0)
done = true; // All combinations have been generated
else indices[i] = 0; // Reset current index and move to the next position
}
}
Expand Down Expand Up @@ -162,7 +163,7 @@ function generateCombinations<T extends TaskInput>(input: T, inputMakeArray: (ke
*/
export function arrayTaskFactory<
PluralInputType extends TaskInput = TaskInput,
PluralOutputType extends TaskOutput = TaskOutput
PluralOutputType extends TaskOutput = TaskOutput,
>(
taskClass: typeof SingleTask | typeof CompoundTask,
inputMakeArray: Array<keyof PluralInputType>,
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/task/base/TaskGraphRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export class TaskGraphRunner {
* @param dag The task graph to run
* @param repository The task output repository to use for caching task outputs
*/
constructor(public dag: TaskGraph, public repository?: TaskOutputRepository) {
constructor(
public dag: TaskGraph,
public repository?: TaskOutputRepository
) {
this.layers = new Map();
this.provenanceInput = new Map();
}
Expand Down
11 changes: 7 additions & 4 deletions packages/core/src/util/Misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ export function deepEqual(a: any, b: any): boolean {
export function sortObject(obj: Record<string, any>): Record<string, any> {
return Object.keys(obj)
.sort()
.reduce((result, key) => {
result[key] = obj[key];
return result;
}, {} as Record<string, any>);
.reduce(
(result, key) => {
result[key] = obj[key];
return result;
},
{} as Record<string, any>
);
}

export function serialize(obj: Record<string, any>): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class IndexedDbKVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Record<string, any> = Key & Value
Combined extends Record<string, any> = Key & Value,
> extends KVRepository<Key, Value, PrimaryKeySchema, ValueSchema, Combined> {
/** Promise that resolves to the IndexedDB database instance */
private dbPromise: Promise<IDBDatabase>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class InMemoryKVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Record<string, any> = Key & Value
Combined extends Record<string, any> = Key & Value,
> extends KVRepository<Key, Value, PrimaryKeySchema, ValueSchema, Combined> {
/** Internal storage using a Map with fingerprint strings as keys */
values = new Map<string, Combined>();
Expand Down
6 changes: 3 additions & 3 deletions packages/storage/src/bun/sqlite/SqliteJobQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class SqliteJobQueue<Input, Output> extends JobQueue<Input, Output> {
input: string,
runAfter: string | null,
deadlineAt: string | null,
maxRetries: number
maxRetries: number,
]
>(AddQuery);

Expand Down Expand Up @@ -225,8 +225,8 @@ export class SqliteJobQueue<Input, Output> extends JobQueue<Input, Output> {
const status = output
? JobStatus.COMPLETED
: error && job.retries >= job.maxRetries
? JobStatus.FAILED
: JobStatus.PENDING;
? JobStatus.FAILED
: JobStatus.PENDING;

const UpdateQuery = `
UPDATE job_queue
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/src/bun/sqlite/base/SqliteKVRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class SqliteKVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Record<string, any> = Key & Value
Combined extends Record<string, any> = Key & Value,
> extends BaseSqlKVRepository<Key, Value, PrimaryKeySchema, ValueSchema, Combined> {
/** The SQLite database instance */
private db: Database;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class FileKVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Key & Value = Key & Value
Combined extends Key & Value = Key & Value,
> extends KVRepository<Key, Value, PrimaryKeySchema, ValueSchema, Combined> {
private folderPath: string;

Expand Down
8 changes: 4 additions & 4 deletions packages/storage/src/node/postgres/PostgresJobQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export class PostgresJobQueue<Input, Output> extends JobQueue<Input, Output> {
return await sql`
INSERT INTO job_queue(queue, fingerprint, input, runAfter, maxRetries)
VALUES (${this.queue!}, ${fingerprint}, ${
job.input as any
}::jsonb, ${job.createdAt.toISOString()}, ${job.maxRetries})
job.input as any
}::jsonb, ${job.createdAt.toISOString()}, ${job.maxRetries})
RETURNING id`;
});
}
Expand Down Expand Up @@ -202,8 +202,8 @@ export class PostgresJobQueue<Input, Output> extends JobQueue<Input, Output> {
const status = output
? JobStatus.COMPLETED
: error && job.retries >= job.maxRetries
? JobStatus.FAILED
: JobStatus.PENDING;
? JobStatus.FAILED
: JobStatus.PENDING;
if (!output || error) job.retries += 1;
await this.sql.begin(async (sql) => {
const result = await sql`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class PostgresKVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Record<string, any> = Key & Value
Combined extends Record<string, any> = Key & Value,
> extends BaseSqlKVRepository<Key, Value, PrimaryKeySchema, ValueSchema, Combined> {
private pool: Pool;

Expand Down
11 changes: 7 additions & 4 deletions packages/storage/src/util/Misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ export function deepEqual(a: any, b: any): boolean {
export function sortObject(obj: Record<string, any>): Record<string, any> {
return Object.keys(obj)
.sort()
.reduce((result, key) => {
result[key] = obj[key];
return result;
}, {} as Record<string, any>);
.reduce(
(result, key) => {
result[key] = obj[key];
return result;
},
{} as Record<string, any>
);
}

export function serialize(obj: Record<string, any>): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/src/util/base/BaseSqlKVRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export abstract class BaseSqlKVRepository<
Value extends Record<string, any> = DefaultValueType,
PrimaryKeySchema extends BasePrimaryKeySchema = typeof DefaultPrimaryKeySchema,
ValueSchema extends BaseValueSchema = typeof DefaultValueSchema,
Combined extends Record<string, any> = Key & Value
Combined extends Record<string, any> = Key & Value,
> extends KVRepository<Key, Value, PrimaryKeySchema, ValueSchema, Combined> {
/**
* Creates a new instance of BaseSqlKVRepository
Expand Down

0 comments on commit 015bd97

Please sign in to comment.