From facb41d7d33bd6c11970da5e946c51347824fd54 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Fri, 8 Sep 2023 10:51:38 +0100 Subject: [PATCH] chore: use `biome` instead of `rome` --- .lintstagedrc.js | 4 +- .../dynamic-worker-nodes.js | 3 +- .../fixed-worker-nodes.js | 3 +- rome.json => biome.json | 2 +- .../typescript/http-client-pool/src/worker.ts | 2 +- package.json | 4 +- pnpm-lock.yaml | 136 +++++++++--------- src/pools/thread/fixed.ts | 4 +- src/pools/worker-node.ts | 2 +- src/worker/abstract-worker.ts | 2 +- 10 files changed, 83 insertions(+), 79 deletions(-) rename rome.json => biome.json (90%) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index a9b248cd..ed9df14a 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,9 +1,9 @@ module.exports = { '**/*.{ts,tsx,js,jsx,cjs,mjs}': [ - 'rome format --write', + 'biome format --write --no-errors-on-unmatched', 'ts-standard --fix', 'eslint --cache --fix' ], - '!(.vscode/**)**/*.json': ['rome format --write'], + '!(.vscode/**)**/*.json': ['biome format --write --no-errors-on-unmatched'], '**/*.{md,yml,yaml}': ['prettier --cache --write'] } diff --git a/benchmarks/versus-external-pools/dynamic-worker-nodes.js b/benchmarks/versus-external-pools/dynamic-worker-nodes.js index 7a77d882..cdac7274 100644 --- a/benchmarks/versus-external-pools/dynamic-worker-nodes.js +++ b/benchmarks/versus-external-pools/dynamic-worker-nodes.js @@ -28,8 +28,7 @@ async function run () { // eslint-disable-next-line n/no-process-exit process.exit() } - -(async () => { +;(async () => { try { await run() } catch (e) { diff --git a/benchmarks/versus-external-pools/fixed-worker-nodes.js b/benchmarks/versus-external-pools/fixed-worker-nodes.js index d5b01353..94008400 100644 --- a/benchmarks/versus-external-pools/fixed-worker-nodes.js +++ b/benchmarks/versus-external-pools/fixed-worker-nodes.js @@ -28,8 +28,7 @@ async function run () { // eslint-disable-next-line n/no-process-exit process.exit() } - -(async () => { +;(async () => { try { await run() } catch (e) { diff --git a/rome.json b/biome.json similarity index 90% rename from rome.json rename to biome.json index 1c91a4d7..55a5f761 100644 --- a/rome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://docs.rome.tools/schemas/12.1.3/schema.json", + "$schema": "https://biomejs.dev/schemas/1.1.2/schema.json", "organizeImports": { "enabled": false }, diff --git a/examples/typescript/http-client-pool/src/worker.ts b/examples/typescript/http-client-pool/src/worker.ts index b7c59629..d9298e3f 100644 --- a/examples/typescript/http-client-pool/src/worker.ts +++ b/examples/typescript/http-client-pool/src/worker.ts @@ -11,7 +11,7 @@ class HttpClientWorker extends ThreadWorker { super({ node_fetch: async (workerData?: WorkerData) => { const response = await nodeFetch( - (workerData as WorkerData).input as URL | NodeFetchRequestInfo, + (workerData as WorkerData).input, workerData?.init as NodeFetchRequestInit ) // The response is not structured-cloneable, so we return the response text body instead. diff --git a/package.json b/package.json index f008ac13..ae19024f 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "test:debug": "pnpm build && mocha --no-parallel --inspect 'tests/**/*.test.js'", "coverage": "c8 report --reporter=lcov", "coverage:html": "c8 report --reporter=html", - "format": "rome format . --write; ts-standard . --fix", + "format": "biome format . --write; ts-standard . --fix", "lint": "eslint . --cache", "lint:fix": "eslint . --cache --fix", "lint:report": "eslint . --cache --format json --output-file reports/eslint.json", @@ -110,6 +110,7 @@ } }, "devDependencies": { + "@biomejs/biome": "1.1.2", "@commitlint/cli": "^17.7.1", "@commitlint/config-conventional": "^17.7.0", "@release-it/bumper": "^5.1.0", @@ -145,7 +146,6 @@ "rollup-plugin-command": "^1.1.3", "rollup-plugin-delete": "^2.0.0", "rollup-plugin-dts": "^6.0.1", - "rome": "^12.1.3", "sinon": "^15.2.0", "source-map-support": "^0.5.21", "ts-standard": "^12.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f74e920..11c2bb20 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ overrides: semver: ^7.5.3 devDependencies: + '@biomejs/biome': + specifier: 1.1.2 + version: 1.1.2 '@commitlint/cli': specifier: ^17.7.1 version: 17.7.1 @@ -113,9 +116,6 @@ devDependencies: rollup-plugin-dts: specifier: ^6.0.1 version: 6.0.1(rollup@3.29.0)(typescript@5.2.2) - rome: - specifier: ^12.1.3 - version: 12.1.3 sinon: specifier: ^15.2.0 version: 15.2.0 @@ -196,6 +196,74 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true + /@biomejs/biome@1.1.2: + resolution: {integrity: sha512-JEVWchqo0Xhl86IJgOh0xESWnNRUXBUDByCBR8TA4lIPzm/6U6Tv77+MblNkZ8MvwCtP6PlBNGdQcGKKabtuHA==} + engines: {node: '>=14.*'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.1.2 + '@biomejs/cli-darwin-x64': 1.1.2 + '@biomejs/cli-linux-arm64': 1.1.2 + '@biomejs/cli-linux-x64': 1.1.2 + '@biomejs/cli-win32-arm64': 1.1.2 + '@biomejs/cli-win32-x64': 1.1.2 + dev: true + + /@biomejs/cli-darwin-arm64@1.1.2: + resolution: {integrity: sha512-YyqWeNZchPxlvxtdo2vMBkzrwllaNS3+DZ6j01mUCVIZE9kAzF/edMV2O38L2AEtnRLU1TI1f71Jai3ThILClg==} + engines: {node: '>=14.*'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-darwin-x64@1.1.2: + resolution: {integrity: sha512-Sofxcu50AHJyQS6Xx3OF2egQQ7Un5YFVF5/umNFa+kSNrrCu/ucmzrk8FcGS2dOSs4L2LqD6ZDWjvbcikjzLYQ==} + engines: {node: '>=14.*'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-linux-arm64@1.1.2: + resolution: {integrity: sha512-wtaQgpoVMZEKf1GlDlFGAJP1j6gnh4L4kJN8PQPOBAdKIUZ/YSjqVp0z28vli5xCQ57xCn1gH4Xoqw2gVYu1tQ==} + engines: {node: '>=14.*'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-linux-x64@1.1.2: + resolution: {integrity: sha512-TYIUjCXbY+kxnJgv8GESplMagB1GdOcMV21JGRATqnhUI4BvG6sjs3gfi+sdjLBQdbHhsISXW3yfUlv07HKqhg==} + engines: {node: '>=14.*'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-win32-arm64@1.1.2: + resolution: {integrity: sha512-yApn85KuJ+Ty5zxbqWnaifX4ONtZG+snu12RNKi8fxSVVCXzQ/k2PfsWQbsyvCG05qshSvNKtM54cuf+vhUIsw==} + engines: {node: '>=14.*'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@biomejs/cli-win32-x64@1.1.2: + resolution: {integrity: sha512-qebNvIrFj2TJ+K0JVGo1HkgV2y5jis6aOZDC1SWuk53GnqjSLdR+p1v86ZByOjYr1v+tjc67EXmEepk06VVvpA==} + engines: {node: '>=14.*'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@commitlint/cli@17.7.1: resolution: {integrity: sha512-BCm/AT06SNCQtvFv921iNhudOHuY16LswT0R3OeolVGLk8oP+Rk9TfQfgjH7QPMjhvp76bNqGFEcpKojxUNW1g==} engines: {node: '>=v14'} @@ -776,54 +844,6 @@ packages: rollup: 3.29.0 dev: true - /@rometools/cli-darwin-arm64@12.1.3: - resolution: {integrity: sha512-AmFTUDYjBuEGQp/Wwps+2cqUr+qhR7gyXAUnkL5psCuNCz3807TrUq/ecOoct5MIavGJTH6R4aaSL6+f+VlBEg==} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@rometools/cli-darwin-x64@12.1.3: - resolution: {integrity: sha512-k8MbWna8q4LRlb005N2X+JS1UQ+s3ZLBBvwk4fP8TBxlAJXUz17jLLu/Fi+7DTTEmMhM84TWj4FDKW+rNar28g==} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /@rometools/cli-linux-arm64@12.1.3: - resolution: {integrity: sha512-X/uLhJ2/FNA3nu5TiyeNPqiD3OZoFfNfRvw6a3ut0jEREPvEn72NI7WPijH/gxSz55znfQ7UQ6iM4DZumUknJg==} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rometools/cli-linux-x64@12.1.3: - resolution: {integrity: sha512-csP17q1eWiUXx9z6Jr/JJPibkplyKIwiWPYNzvPCGE8pHlKhwZj3YHRuu7Dm/4EOqx0XFIuqqWZUYm9bkIC8xg==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /@rometools/cli-win32-arm64@12.1.3: - resolution: {integrity: sha512-RymHWeod57EBOJY4P636CgUwYA6BQdkQjh56XKk4pLEHO6X1bFyMet2XL7KlHw5qOTalzuzf5jJqUs+vf3jdXQ==} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /@rometools/cli-win32-x64@12.1.3: - resolution: {integrity: sha512-yHSKYidqJMV9nADqg78GYA+cZ0hS1twANAjiFibQdXj9aGzD+s/IzIFEIi/U/OBLvWYg/SCw0QVozi2vTlKFDQ==} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -5531,20 +5551,6 @@ packages: fsevents: 2.3.3 dev: true - /rome@12.1.3: - resolution: {integrity: sha512-e+ff72hxDpe/t5/Us7YRBVw3PBET7SeczTQNn6tvrWdrCaAw3qOukQQ+tDCkyFtS4yGsnhjrJbm43ctNbz27Yg==} - engines: {node: '>=14.*'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@rometools/cli-darwin-arm64': 12.1.3 - '@rometools/cli-darwin-x64': 12.1.3 - '@rometools/cli-linux-arm64': 12.1.3 - '@rometools/cli-linux-x64': 12.1.3 - '@rometools/cli-win32-arm64': 12.1.3 - '@rometools/cli-win32-x64': 12.1.3 - dev: true - /run-applescript@5.0.0: resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} engines: {node: '>=12'} diff --git a/src/pools/thread/fixed.ts b/src/pools/thread/fixed.ts index d69055cf..9acfd640 100644 --- a/src/pools/thread/fixed.ts +++ b/src/pools/thread/fixed.ts @@ -82,7 +82,7 @@ export class FixedThreadPool< message: MessageValue, transferList?: TransferListItem[] ): void { - ( + ;( this.workerNodes[workerNodeKey].messageChannel as MessageChannel ).port1.postMessage(message, transferList) } @@ -108,7 +108,7 @@ export class FixedThreadPool< workerNodeKey: number, listener: (message: MessageValue) => void ): void { - ( + ;( this.workerNodes[workerNodeKey].messageChannel as MessageChannel ).port1.on('message', listener) } diff --git a/src/pools/worker-node.ts b/src/pools/worker-node.ts index ca275ded..dd116dfb 100644 --- a/src/pools/worker-node.ts +++ b/src/pools/worker-node.ts @@ -169,7 +169,7 @@ implements IWorkerNode { this.onEmptyQueueCount = 0 return } - (this.onEmptyQueue as WorkerNodeEventCallback)(this.info.id as number) + ;(this.onEmptyQueue as WorkerNodeEventCallback)(this.info.id as number) ++this.onEmptyQueueCount await sleep(exponentialDelay(this.onEmptyQueueCount)) await this.startOnEmptyQueue() diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index ca14133f..a0d78dbd 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -351,7 +351,7 @@ export abstract class AbstractWorker< protected handleKillMessage (message: MessageValue): void { this.stopCheckActive() if (isAsyncFunction(this.opts.killHandler)) { - (this.opts.killHandler?.() as Promise) + ;(this.opts.killHandler?.() as Promise) .then(() => { this.sendToMainWorker({ kill: 'success', workerId: this.id }) return null -- 2.34.1