chore(root): migrate to biome

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-16 12:20:40 +02:00
parent 1f6e198336
commit 32e91959f6
383 changed files with 1943 additions and 3085 deletions

View File

@@ -4,26 +4,13 @@
"module": "index.ts",
"scripts": {
"build": "rm -rf dist && tsup",
"lint": "eslint .",
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
"typecheck": "tsc --noEmit"
},
"dependencies": {},
"devDependencies": {
"@openpanel/eslint-config": "workspace:*",
"@openpanel/prettier-config": "workspace:*",
"@openpanel/tsconfig": "workspace:*",
"@types/node": "^20.14.12",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
},
"eslintConfig": {
"root": true,
"extends": [
"@openpanel/eslint-config/base"
]
},
"prettier": "@openpanel/prettier-config"
}
}
}

View File

@@ -44,7 +44,7 @@ export class Api {
url: string,
data: ReqBody,
options: FetchOptions,
attempt: number
attempt: number,
): Promise<ResBody | null> {
try {
const response = await fetch(url, {
@@ -65,7 +65,7 @@ export class Api {
return responseText ? JSON.parse(responseText) : null;
} catch (error) {
if (attempt < this.maxRetries) {
const delay = this.initialRetryDelay * Math.pow(2, attempt);
const delay = this.initialRetryDelay * 2 ** attempt;
await new Promise((resolve) => setTimeout(resolve, delay));
return this.post<ReqBody, ResBody>(url, data, options, attempt + 1);
}
@@ -77,7 +77,7 @@ export class Api {
async fetch<ReqBody, ResBody>(
path: string,
data: ReqBody,
options: FetchOptions = {}
options: FetchOptions = {},
): Promise<ResBody | null> {
const url = `${this.baseUrl}${path}`;
return this.post<ReqBody, ResBody>(url, data, options, 0);

View File

@@ -1,5 +1,7 @@
import { defineConfig } from 'tsup';
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
import config from '@openpanel/tsconfig/tsup.config.json' assert {
type: 'json',
};
export default defineConfig(config as any);