feat: add ESLint and Prettier configuration for code quality

- Added ESLint with TypeScript support and custom rules.
- Introduced Prettier for consistent code formatting.
- Updated package.json to include lint and format scripts.
- Modified db.ts to ensure proper parsing of BIGINT types from PostgreSQL.
- Enhanced webRoutes to coerce timestamp fields to numbers and format isDeleted as boolean.
This commit is contained in:
2025-10-25 17:33:48 +02:00
parent 09a2b09913
commit 14c80197cc
13 changed files with 1620 additions and 44 deletions
+15
View File
@@ -2,6 +2,8 @@ plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.devtools.ksp'
id 'org.jlleitschuh.gradle.ktlint'
id 'io.gitlab.arturbosch.detekt'
}
android {
@@ -87,3 +89,16 @@ dependencies {
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
}
// Ktlint configuration
ktlint {
android.set(true)
ignoreFailures.set(false)
outputToConsole.set(true)
}
// Detekt configuration (uses default rules; customize via detekt.yml if needed)
detekt {
buildUponDefaultConfig = true
allRules = false
}
@@ -36,6 +36,7 @@ object WebSocketSyncClient {
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.pingInterval(15, TimeUnit.SECONDS)
.build()
private fun buildWebSocketUrl(httpApiBaseUrl: String): String {
@@ -127,8 +128,8 @@ object WebSocketSyncClient {
try {
socket = client.newWebSocket(httpRequest, listener)
// Wait up to 15s for response
val result = withTimeout(15_000) { deferred.await() }
// Wait up to 30s for response (WS roundtrip)
val result = withTimeout(30_000) { deferred.await() }
return@withContext result
} catch (e: Exception) {
Logger.w("WS", "Falling back to HTTP sync: ${e.message}")