From 92c529d8b7b8e059335fbb5407ea40d9d023c0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Skr=C3=B8vseth?= Date: Mon, 26 Aug 2024 10:37:58 +0200 Subject: [PATCH] Fix linting and formatting --- server/.vscode/launch.json | 11 +++------- server/.vscode/settings.json | 20 +++++++++++++++++-- server/biome.json | 7 ++----- server/package.json | 2 +- server/src/plugins/health.ts | 2 +- .../serve-index/remove-saksnummer.test.ts | 2 +- server/src/slack.ts | 2 +- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/server/.vscode/launch.json b/server/.vscode/launch.json index 757b661a..351e5f9c 100644 --- a/server/.vscode/launch.json +++ b/server/.vscode/launch.json @@ -1,18 +1,13 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", - "skipFiles": [ - "/**" - ], + "skipFiles": ["/**"], "program": "${workspaceFolder}/dist/server.js", - "cwd": "${workspaceFolder}", + "cwd": "${workspaceFolder}" } ] -} \ No newline at end of file +} diff --git a/server/.vscode/settings.json b/server/.vscode/settings.json index 919d78ef..b5324eee 100644 --- a/server/.vscode/settings.json +++ b/server/.vscode/settings.json @@ -4,10 +4,11 @@ "editor.defaultFormatter": "biomejs.biome", "editor.codeActionsOnSave": { "quickfix.biome": "always", - "source.fixAll.biome": "always", + "source.fixAll.biome": "always", "source.organizeImports.biome": "always", "source.addMissingImports.ts": "explicit" }, + "editor.acceptSuggestionOnCommitCharacter": false, "typescript.validate.enable": true, "typescript.tsdk": "node_modules/typescript/lib", "typescript.preferences.importModuleSpecifier": "non-relative", @@ -21,7 +22,22 @@ "liveshare.allowGuestDebugControl": true, "liveshare.allowGuestTaskControl": true, "liveshare.notebooks.allowGuestExecuteCells": true, - "[json][javascript][javascriptreact][typescript][typescriptreact]": { + "[typescript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[javascript]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[javascriptreact]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[json]": { + "editor.defaultFormatter": "biomejs.biome" + }, + "[jsonc]": { "editor.defaultFormatter": "biomejs.biome" } } diff --git a/server/biome.json b/server/biome.json index eb7da8d6..29a84b57 100644 --- a/server/biome.json +++ b/server/biome.json @@ -48,9 +48,6 @@ } }, "files": { - "ignore": [ - ".vscode/**", - "dist/**" - ] + "ignore": ["dist/**"] } -} \ No newline at end of file +} diff --git a/server/package.json b/server/package.json index aa5b978f..312485db 100644 --- a/server/package.json +++ b/server/package.json @@ -28,4 +28,4 @@ "@types/node": "22.5.0", "typescript": "5.5.4" } -} \ No newline at end of file +} diff --git a/server/src/plugins/health.ts b/server/src/plugins/health.ts index ca3c24d2..54cc3594 100644 --- a/server/src/plugins/health.ts +++ b/server/src/plugins/health.ts @@ -14,7 +14,7 @@ export const healthPlugin = fastifyPlugin( app.get('/isReady', async (__, reply) => { const isTokenXClientReady = getIsTokenXClientReady(); - if (!oboCache.isReady && !isTokenXClientReady) { + if (!(oboCache.isReady || isTokenXClientReady)) { log.info({ msg: 'OBO Cache and TokenX Client not ready' }); return reply.status(503).type('text/plain').send('OBO Cache and TokenX Client not ready'); diff --git a/server/src/plugins/serve-index/remove-saksnummer.test.ts b/server/src/plugins/serve-index/remove-saksnummer.test.ts index 845a847e..e961bb8b 100644 --- a/server/src/plugins/serve-index/remove-saksnummer.test.ts +++ b/server/src/plugins/serve-index/remove-saksnummer.test.ts @@ -1,5 +1,5 @@ -import { removeSaksnummer } from '@app/plugins/serve-index/remove-saksnummer'; import { describe, expect, it } from 'bun:test'; +import { removeSaksnummer } from '@app/plugins/serve-index/remove-saksnummer'; describe('redirect', () => { it('should remove the whole query when saksnummer is only param', () => { diff --git a/server/src/slack.ts b/server/src/slack.ts index 451dd169..75846c19 100644 --- a/server/src/slack.ts +++ b/server/src/slack.ts @@ -20,7 +20,7 @@ const isConfigured = url !== undefined && url.length !== 0; export const sendToSlack = async (message: string, icon_emoji: EmojiIcons) => { const text = `[${ENVIRONMENT}] ${messagePrefix} ${message}`; - if (!isDeployed || !isConfigured) { + if (!(isDeployed && isConfigured)) { return; }