From 33aff1714f2f0c89b56e26d4aae099244b4a72e5 Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 17:47:53 +0700 Subject: [PATCH 01/12] Uninstall eslint & prettier packages --- package.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/package.json b/package.json index fd16dc3b..5d990d33 100644 --- a/package.json +++ b/package.json @@ -37,16 +37,10 @@ "@babel/preset-env": "^7.7.1", "@babel/preset-typescript": "^7.18.6", "@types/node": "^20.10.4", - "@typescript-eslint/eslint-plugin": "^6.13.2", - "@typescript-eslint/parser": "^6.13.2", "babel-plugin-add-import-extension": "^1.6.0", "babel-plugin-transform-inline-environment-variables": "^0.4.4", "cross-env": "^7.0.3", - "eslint": "^8.56.0", - "eslint-config-prettier": "^8.10.0", - "eslint-plugin-import": "^2.29.1", "np": "^9.2.0", - "prettier": "^2.8.8", "rimraf": "^3.0.0", "typescript": "^5.3.3", "vitest": "^1.2.2", From 5bfc412e688d8d7a7a84f2eff74e8f9b1a069c41 Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 17:53:14 +0700 Subject: [PATCH 02/12] Install biome --- package.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5d990d33..843c5028 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "@babel/plugin-proposal-export-namespace-from": "^7.18.9", "@babel/preset-env": "^7.7.1", "@babel/preset-typescript": "^7.18.6", + "@biomejs/biome": "^2.2.4", + "@prezly/biome-config": "^1.0.1", "@types/node": "^20.10.4", "babel-plugin-add-import-extension": "^1.6.0", "babel-plugin-transform-inline-environment-variables": "^0.4.4", @@ -55,8 +57,8 @@ "build:cjs": "babel ./src --ignore='**/*.test.ts' --config-file=./babel.config.cjs.json --extensions=.ts,.cts --source-root=./src --out-dir=./dist --out-file-extension .cjs", "watch": "tsc --watch --preserveWatchOutput --project .", "start": "npm run build --incremental --watch", - "lint": "eslint ./src --ext=.ts", - "lint:fix": "npm run lint -- --fix", + "lint": "biome lint ./src", + "lint:fix": "biome lint ./src --write", "test": "npm run test:build && npm run test:unit", "test:unit": "vitest run", "test:build": "node dist/index.js && tsc --noEmit dist/index.d.ts", From f2957312f5fff4b0b817fdc241cb0dcf11ebdf3e Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 17:53:22 +0700 Subject: [PATCH 03/12] Add basic biome config --- biome.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 biome.json diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..49dbdd82 --- /dev/null +++ b/biome.json @@ -0,0 +1,3 @@ +{ + "extends": ["@prezly/biome-config"] +} \ No newline at end of file From 07a832d0790876741ef4f6d5ea4efe81b11b665f Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 18:06:42 +0700 Subject: [PATCH 04/12] Use biome in scripts --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 843c5028..d6220cea 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,8 @@ "test": "npm run test:build && npm run test:unit", "test:unit": "vitest run", "test:build": "node dist/index.js && tsc --noEmit dist/index.d.ts", - "prettier:check": "prettier --check './src/**/*.{ts,js}'", - "prettier:fix": "prettier --write './src/**/*.{ts,js}'", + "format:check": "biome format ./src", + "format": "biome format ./src --write", "prerelease": "npm run build", "release": "np" }, From 53ceb8d12114f87e71e3a8fd052c35df3c1b3f84 Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 18:17:46 +0700 Subject: [PATCH 05/12] Update biome config --- biome.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/biome.json b/biome.json index 49dbdd82..5822fc71 100644 --- a/biome.json +++ b/biome.json @@ -1,3 +1,14 @@ { - "extends": ["@prezly/biome-config"] -} \ No newline at end of file + "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", + "extends": ["@prezly/biome-config"], + "files": { + "includes": ["src/**"] + }, + "linter": { + "rules": { + "suspicious": { + "noShadowRestrictedNames": "off" + } + } + } +} From 1eb11b9be064803a12f0cc8707c627850e8ee804 Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 18:20:17 +0700 Subject: [PATCH 06/12] Format code with biome --- src/Client.test.ts | 2 +- src/api/DeferredJobsApiClient.ts | 3 ++- src/http/createRequest.ts | 4 ++-- src/types/Category.ts | 2 +- src/types/SortOrder.ts | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Client.test.ts b/src/Client.test.ts index bbfec20e..5638970d 100644 --- a/src/Client.test.ts +++ b/src/Client.test.ts @@ -1,4 +1,4 @@ -import { readFileSync } from 'fs'; +import { readFileSync } from 'node:fs'; import { vi, beforeEach, describe, expect, it, afterEach } from 'vitest'; import type { MockResponseInitFunction } from 'vitest-fetch-mock'; import createFetchMock from 'vitest-fetch-mock'; diff --git a/src/api/DeferredJobsApiClient.ts b/src/api/DeferredJobsApiClient.ts index e1955bce..5e8a1537 100644 --- a/src/api/DeferredJobsApiClient.ts +++ b/src/api/DeferredJobsApiClient.ts @@ -48,7 +48,8 @@ function handleDeferredJob( update(state.progress, state.value); await sleep(JOB_STATUS_POLLING_INTERVAL); - } while (true); // eslint-disable-line no-constant-condition + // biome-ignore lint/correctness/noConstantCondition: + } while (true); } resolve(response.payload); diff --git a/src/http/createRequest.ts b/src/http/createRequest.ts index 18f751f8..4c722257 100644 --- a/src/http/createRequest.ts +++ b/src/http/createRequest.ts @@ -85,10 +85,10 @@ export async function createRequest

( if (!response.ok) { // Try to parse the response as JSON, if it contains any error messages // from backend. If not, fake the error message. - let responsePayload; + let responsePayload: undefined | ApiResponse

; try { responsePayload = await response.json(); - } catch (error) { + } catch { responsePayload = createFakeErrorPayload(response); } diff --git a/src/types/Category.ts b/src/types/Category.ts index bbfee4ba..06692b65 100644 --- a/src/types/Category.ts +++ b/src/types/Category.ts @@ -114,7 +114,7 @@ type WithNonEmptyTranslation Date: Thu, 25 Sep 2025 18:56:37 +0700 Subject: [PATCH 07/12] Remove eslint and prettier config files --- .eslintrc.cjs | 52 --------------------------------------------------- .prettierrc | 5 ----- 2 files changed, 57 deletions(-) delete mode 100644 .eslintrc.cjs delete mode 100644 .prettierrc diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 672320d0..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,52 +0,0 @@ -module.exports = { - "env": { - "browser": true, - "es2021": true - }, - "extends": [ - "prettier", - "eslint:recommended", - "plugin:@typescript-eslint/recommended" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 12, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint", - "import", - ], - "rules": { - "import/no-default-export": "error", - "import/no-extraneous-dependencies": "error", - "func-style": ["error", "declaration"], - "import/order": [ - "error", - { - "alphabetize": { - "order": "asc", - "caseInsensitive": true - }, - "groups": [["builtin", "external"], "internal", "parent", "sibling", "index"], - "newlines-between": "always" - } - ], - "@typescript-eslint/ban-ts-comment": "warn", - "@typescript-eslint/consistent-type-imports": "error", - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-namespace": "off", - "@typescript-eslint/no-unused-vars": "warn", - "@typescript-eslint/no-inferrable-types": "warn" - }, - "overrides": [ - { - "files": ["**/*.test.*"], - "rules": { - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-non-null-assertion": "off", - } - }, - ] -} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index a174dd40..00000000 --- a/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -tabWidth: 4 -printWidth: 100 -singleQuote: true -arrowParens: always -trailingComma: all From 7c0283815c8779f4e95c8c12711c0ce066d1daaa Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 19:15:52 +0700 Subject: [PATCH 08/12] Update github workflow --- .github/workflows/check.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 160184b8..857cc348 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -46,6 +46,3 @@ jobs: - name: test run: npm test - - - name: prettier - run: npm run prettier:check From bfd8e830ff5f35fd351bbecfaba39ce9c3cba95b Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Thu, 25 Sep 2025 19:16:59 +0700 Subject: [PATCH 09/12] Update scripts --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d6220cea..c1c394e4 100644 --- a/package.json +++ b/package.json @@ -57,13 +57,13 @@ "build:cjs": "babel ./src --ignore='**/*.test.ts' --config-file=./babel.config.cjs.json --extensions=.ts,.cts --source-root=./src --out-dir=./dist --out-file-extension .cjs", "watch": "tsc --watch --preserveWatchOutput --project .", "start": "npm run build --incremental --watch", - "lint": "biome lint ./src", - "lint:fix": "biome lint ./src --write", + "lint": "biome ci", + "lint:fix": "biome lint --write", "test": "npm run test:build && npm run test:unit", "test:unit": "vitest run", "test:build": "node dist/index.js && tsc --noEmit dist/index.d.ts", - "format:check": "biome format ./src", - "format": "biome format ./src --write", + "format:check": "biome format", + "format": "biome format --write", "prerelease": "npm run build", "release": "np" }, From 1e6207790c22bfe6ceae664a4e95d68f8cc5317c Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Fri, 26 Sep 2025 00:13:22 +0700 Subject: [PATCH 10/12] Update workflow step name --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 857cc348..93113067 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,7 +4,7 @@ on: [push] jobs: build: - name: Build, Test & Prettier + name: Lint, Build & Test runs-on: ubuntu-latest From 6eb59cb199d65bc78462625bbf146dc1cdf6c528 Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Fri, 26 Sep 2025 00:13:27 +0700 Subject: [PATCH 11/12] Remove redundant comment --- src/types/Story.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/Story.test.ts b/src/types/Story.test.ts index 5adc6959..ab2e7427 100644 --- a/src/types/Story.test.ts +++ b/src/types/Story.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/ban-ts-comment */ import { describe, expect, it } from 'vitest'; import type { Story, StoryRef } from './Story'; From f2e1a220d2d189a5a9e6be08468f63544022a8a6 Mon Sep 17 00:00:00 2001 From: Yuriy Yakym Date: Fri, 26 Sep 2025 00:29:40 +0700 Subject: [PATCH 12/12] Update types --- src/http/createRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/createRequest.ts b/src/http/createRequest.ts index 4c722257..f9c449d5 100644 --- a/src/http/createRequest.ts +++ b/src/http/createRequest.ts @@ -85,7 +85,7 @@ export async function createRequest

( if (!response.ok) { // Try to parse the response as JSON, if it contains any error messages // from backend. If not, fake the error message. - let responsePayload: undefined | ApiResponse

; + let responsePayload: any; try { responsePayload = await response.json(); } catch {