Skip to content

Commit aa2e623

Browse files
committed
Linting
1 parent c986cb5 commit aa2e623

File tree

6 files changed

+29
-21
lines changed

6 files changed

+29
-21
lines changed

packages/db/src/collection/sync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
import type { StandardSchemaV1 } from "@standard-schema/spec"
1111
import type {
1212
ChangeMessage,
13-
CollectionConfig,
1413
CleanupFn,
14+
CollectionConfig,
1515
OnLoadMoreOptions,
1616
SyncConfigRes,
1717
} from "../types"

packages/db/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// Re-export all public APIs
2+
// Re-export IR types under their own namespace
3+
// because custom collections need access to the IR types
4+
import * as IR from "./query/ir.js"
5+
26
export * from "./collection/index.js"
37
export * from "./SortedMap"
48
export * from "./transactions"
@@ -10,10 +14,6 @@ export * from "./local-only"
1014
export * from "./local-storage"
1115
export * from "./errors"
1216

13-
// Re-export IR types under their own namespace
14-
// because custom collections need access to the IR types
15-
import * as IR from "./query/ir.js"
16-
1717
// Index system exports
1818
export * from "./indexes/base-index.js"
1919
export * from "./indexes/btree-index.js"

packages/db/src/query/compiler/expressions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ export function convertOrderByToBasicExpression(
102102
)
103103

104104
if (!basicExp) {
105-
throw new Error(`Failed to convert orderBy expression to a basic expression: ${clause.expression}`)
105+
throw new Error(
106+
`Failed to convert orderBy expression to a basic expression: ${clause.expression}`
107+
)
106108
}
107109

108110
return {
@@ -112,4 +114,4 @@ export function convertOrderByToBasicExpression(
112114
})
113115

114116
return normalizedOrderBy
115-
}
117+
}

packages/db/src/query/live/collection-subscriber.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { MultiSet } from "@tanstack/db-ivm"
2-
import { convertOrderByToBasicExpression, convertToBasicExpression } from "../compiler/expressions.js"
2+
import {
3+
convertOrderByToBasicExpression,
4+
convertToBasicExpression,
5+
} from "../compiler/expressions.js"
36
import type { FullSyncState } from "./types.js"
47
import type { MultiSetArray, RootStreamBuilder } from "@tanstack/db-ivm"
58
import type { Collection } from "../../collection/index.js"
@@ -168,7 +171,10 @@ export class CollectionSubscriber<
168171
subscription.setOrderByIndex(index)
169172

170173
// Normalize the orderBy clauses such that the references are relative to the collection
171-
const normalizedOrderBy = convertOrderByToBasicExpression(orderBy, this.collectionAlias)
174+
const normalizedOrderBy = convertOrderByToBasicExpression(
175+
orderBy,
176+
this.collectionAlias
177+
)
172178

173179
// Load the first `offset + limit` values from the index
174180
// i.e. the K items from the collection that fall into the requested range: [offset, offset + limit[
@@ -240,7 +246,7 @@ export class CollectionSubscriber<
240246
const biggestSentValue = biggestSentRow
241247
? valueExtractorForRawRow(biggestSentRow)
242248
: biggestSentRow
243-
249+
244250
// Normalize the orderBy clauses such that the references are relative to the collection
245251
const normalizedOrderBy = convertOrderByToBasicExpression(
246252
orderBy,

packages/db/tests/query/order-by.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,8 @@ function createOrderByTests(autoIndex: `off` | `eager`): void {
797797
)
798798

799799
const liveQuery = createLiveQueryCollection({
800-
query: (q) =>
801-
q
800+
query: (qb) =>
801+
qb
802802
.from({ vehicleDocuments: vehicleDocumentCollection })
803803
.groupBy((q) => q.vehicleDocuments.vin)
804804
.orderBy((q) => q.vehicleDocuments.vin, `asc`)
@@ -853,8 +853,8 @@ function createOrderByTests(autoIndex: `off` | `eager`): void {
853853
)
854854

855855
const liveQuery = createLiveQueryCollection({
856-
query: (q) =>
857-
q
856+
query: (qb) =>
857+
qb
858858
.from({ vehicleDocuments: vehicleDocumentCollection })
859859
.groupBy((q) => q.vehicleDocuments.vin)
860860
.orderBy((q) => max(q.vehicleDocuments.updatedAt), `desc`)

packages/db/tests/transactions.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ describe(`Transactions`, () => {
233233
})
234234
it(`commit() should throw errors when mutation function fails`, async () => {
235235
const tx = createTransaction({
236-
mutationFn: async () => {
236+
mutationFn: () => {
237237
throw new Error(`API failed`)
238238
},
239239
autoCommit: false,
@@ -269,7 +269,7 @@ describe(`Transactions`, () => {
269269
it(`commit() and isPersisted.promise should reject with the same error instance`, async () => {
270270
const originalError = new Error(`Original API error`)
271271
const tx = createTransaction({
272-
mutationFn: async () => {
272+
mutationFn: () => {
273273
throw originalError
274274
},
275275
autoCommit: false,
@@ -315,7 +315,7 @@ describe(`Transactions`, () => {
315315

316316
it(`should handle non-Error throwables (strings)`, async () => {
317317
const tx = createTransaction({
318-
mutationFn: async () => {
318+
mutationFn: () => {
319319
throw `string error`
320320
},
321321
autoCommit: false,
@@ -355,7 +355,7 @@ describe(`Transactions`, () => {
355355

356356
it(`should handle non-Error throwables (numbers, objects)`, async () => {
357357
const tx = createTransaction({
358-
mutationFn: async () => {
358+
mutationFn: () => {
359359
throw 42
360360
},
361361
autoCommit: false,
@@ -371,7 +371,7 @@ describe(`Transactions`, () => {
371371
}
372372

373373
const tx2 = createTransaction({
374-
mutationFn: async () => {
374+
mutationFn: () => {
375375
throw { code: `ERR_FAILED`, details: `Something went wrong` }
376376
},
377377
autoCommit: false,
@@ -405,7 +405,7 @@ describe(`Transactions`, () => {
405405

406406
it(`should throw TransactionNotPendingCommitError when commit() is called on failed transaction`, async () => {
407407
const tx = createTransaction({
408-
mutationFn: async () => {
408+
mutationFn: () => {
409409
throw new Error(`Failed`)
410410
},
411411
autoCommit: false,
@@ -440,7 +440,7 @@ describe(`Transactions`, () => {
440440
it(`should handle cascading rollbacks with proper error propagation`, async () => {
441441
const originalError = new Error(`Primary transaction failed`)
442442
const tx1 = createTransaction({
443-
mutationFn: async () => {
443+
mutationFn: () => {
444444
throw originalError
445445
},
446446
autoCommit: false,

0 commit comments

Comments
 (0)