Skip to content

Commit 7427323

Browse files
authored
feat: migrate to biomejs (#178)
1 parent ba75c3e commit 7427323

78 files changed

Lines changed: 284 additions & 675 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.biomeignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.git*
2+
.vercel/
3+
.trae/
4+
dist/
5+
node_modules/
6+
temp/
7+
8+
bun.lock
9+
10+
*.db
11+
*.wal
12+
**/*.d.ts

backend/eslint.config.ts

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

backend/package.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@
2929
"@types/bun": "catalog:",
3030
"@types/node": "catalog:",
3131
"@types/oauth": "^0.9.6",
32-
"@typescript-eslint/eslint-plugin": "catalog:",
33-
"@typescript-eslint/parser": "catalog:",
3432
"bun-types": "catalog:",
35-
"eslint": "catalog:",
36-
"eslint-config-prettier": "catalog:",
37-
"eslint-plugin-no-relative-import-paths": "catalog:",
38-
"eslint-plugin-prettier": "catalog:",
39-
"prettier": "catalog:",
40-
"typescript": "catalog:",
41-
"typescript-eslint": "catalog:"
33+
"typescript": "catalog:"
4234
}
4335
}

backend/src/api/project/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import {
44
ColumnNameSchema,
55
GetProjectByIdResponse,
66
PaginationQuery,
7+
type Project,
78
ProjectParams,
89
ProjectResponseSchema,
910
ReplaceOperationSchema,
10-
type Project,
1111
} from '@backend/api/project/schemas'
1212
import { databasePlugin } from '@backend/plugins/database'
1313
import { errorHandlerPlugin } from '@backend/plugins/error-handler'
@@ -17,7 +17,8 @@ import { TrimWhitespaceService } from '@backend/services/trim-whitespace.service
1717
import { UppercaseConversionService } from '@backend/services/uppercase-conversion.service'
1818
import { ApiErrorHandler } from '@backend/types/error-handler'
1919
import { ApiErrors } from '@backend/types/error-schemas'
20-
import { enhanceSchemaWithTypes, type DuckDBTablePragma } from '@backend/utils/duckdb-types'
20+
import { type DuckDBTablePragma, enhanceSchemaWithTypes } from '@backend/utils/duckdb-types'
21+
import type { DuckDBResultReader } from '@duckdb/node-api'
2122
import cors from '@elysiajs/cors'
2223
import { Elysia, t } from 'elysia'
2324

@@ -407,7 +408,7 @@ export const projectRoutes = new Elysia({ prefix: '/api/project' })
407408
// DuckDB's read_json_auto will handle the parsing
408409

409410
// Check if a table with the same project ID already exists
410-
let tableExistsReader
411+
let tableExistsReader: DuckDBResultReader
411412
try {
412413
tableExistsReader = await db().runAndReadAll(
413414
`SELECT 1 FROM duckdb_tables() WHERE table_name = 'project_${projectId}'`,

backend/src/plugins/database.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { DuckDBConnection, DuckDBInstance } from '@duckdb/node-api'
2-
import { Elysia } from 'elysia'
31
import path from 'node:path'
2+
import { type DuckDBConnection, DuckDBInstance } from '@duckdb/node-api'
3+
import { Elysia } from 'elysia'
44

55
let connection: DuckDBConnection | null = null
66
let instance: DuckDBInstance | null = null

backend/src/services/commons-upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class CommonsUploadService {
9393
lastError = error as Error
9494

9595
if (attempt < retries) {
96-
await this.sleep(this.retryDelay * Math.pow(2, attempt))
96+
await this.sleep(this.retryDelay * 2 ** attempt)
9797
}
9898
}
9999
}

backend/src/services/constraint-validation.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export class ConstraintValidationService {
325325
}
326326

327327
const numericValue = typeof value === 'number' ? value : parseFloat(value)
328-
if (isNaN(numericValue)) {
328+
if (Number.isNaN(numericValue)) {
329329
return {
330330
constraintType: 'range_constraint',
331331
message: `Value "${value}" is not a valid number for range constraint`,
@@ -437,10 +437,11 @@ export class ConstraintValidationService {
437437
}
438438
break
439439

440-
case 'single value constraint':
440+
case 'single value constraint': {
441441
const violation = this.validateSingleValueConstraint(values, constraint, propertyId)
442442
if (violation) violations.push(violation)
443443
break
444+
}
444445

445446
default:
446447
// For unsupported constraint types, add a warning

backend/src/services/file-processor/file-buffer-extractor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { basename } from 'node:path'
12
import { readFromFilepath, readFromUrl } from '@backend/services/file-processor/file-reader'
23
import type { FileInput } from '@backend/services/file-processor/types'
3-
import { basename } from 'node:path'
44

55
export const extractFileBuffer = async (
66
uploadFile: FileInput,

backend/src/services/file-processor/metadata-builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { extname } from 'node:path'
12
import { calculateFileHash } from '@backend/services/file-processor/hash-calculator'
23
import { extractImageMetadata } from '@backend/services/file-processor/image-extractor'
34
import { detectMimeType } from '@backend/services/file-processor/mime-detector'
45
import type { FileInput, FileMetadata } from '@backend/services/file-processor/types'
5-
import { extname } from 'node:path'
66

77
export const buildFileMetadata = async (
88
buffer: ArrayBuffer,

backend/src/services/file-processor/multiple-files-processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { basename } from 'node:path'
12
import { processFile } from '@backend/services/file-processor/processor'
23
import type {
34
FileInput,
45
FileValidationOptions,
56
ProcessedFile,
67
} from '@backend/services/file-processor/types'
7-
import { basename } from 'node:path'
88

99
export const processMultipleFiles = async (
1010
uploadFiles: FileInput[],

0 commit comments

Comments
 (0)