From f913c68ce1ad111704f1f319706cb99e9659e236 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 8 Sep 2023 12:45:59 +0200 Subject: [PATCH] chore: use biome instead of rome MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit https://biomejs.dev/blog/biome-v1 Signed-off-by: Jérôme Benoit --- .lintstagedrc.js | 4 +- benchmark-utils.mjs | 2 +- rome.json => biome.json | 10 ++- busy-wait.mjs | 4 +- deep-clone-object.mjs | 2 +- deep-merge-object.mjs | 2 +- empty-array.mjs | 2 +- fibonacci.mjs | 2 +- is-empty-object.mjs | 2 +- is-undefined.mjs | 2 +- max.mjs | 2 +- min.mjs | 2 +- package.json | 4 +- pnpm-lock.yaml | 162 ++++++++++++++++++++------------------- promise-handling.mjs | 8 +- quick-select.mjs | 2 +- random.mjs | 2 +- shallow-clone-object.mjs | 2 +- uuid-generator.mjs | 2 +- 19 files changed, 115 insertions(+), 103 deletions(-) rename rome.json => biome.json (68%) diff --git a/.lintstagedrc.js b/.lintstagedrc.js index d0c795d..b31b961 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,9 +1,9 @@ module.exports = { '*.{js,jsx,cjs,mjs}': [ - 'rome format --write', + 'biome format --write', 'standard --fix', 'eslint --cache --fix' ], - '!(.vscode/**)*.json': ['rome format --write'], + '*.json': ['biome format --write'], '*.{md,yml,yaml}': ['prettier --cache --write'] } diff --git a/benchmark-utils.mjs b/benchmark-utils.mjs index d3757b5..e914e6b 100644 --- a/benchmark-utils.mjs +++ b/benchmark-utils.mjs @@ -93,5 +93,5 @@ export function generateRandomObject ( * @returns */ export async function sleep (ms) { - return new Promise((resolve) => setTimeout(resolve, ms)) + return new Promise(resolve => setTimeout(resolve, ms)) } diff --git a/rome.json b/biome.json similarity index 68% rename from rome.json rename to biome.json index d45bc64..ce653d3 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 }, @@ -18,7 +18,13 @@ "formatter": { "quoteStyle": "single", "trailingComma": "none", - "semicolons": "asNeeded" + "semicolons": "asNeeded", + "arrowParentheses": "asNeeded" + } + }, + "json": { + "parser": { + "allowComments": true } }, "files": { diff --git a/busy-wait.mjs b/busy-wait.mjs index 2add046..dd8a74f 100644 --- a/busy-wait.mjs +++ b/busy-wait.mjs @@ -45,7 +45,7 @@ async function divideAndConquerTimeoutBusyWait ( * @param intervalMs */ async function setIntervalTimeoutBusyWait (timeoutMs, intervalMs = interval) { - return new Promise((resolve) => { + return new Promise(resolve => { const tries = Math.round(timeoutMs / intervalMs) let count = 0 const triesSetInterval = setInterval(() => { @@ -77,6 +77,6 @@ Benchmark.suite( Benchmark.save({ file: 'busy-wait', format: 'json', details: true }), Benchmark.save({ file: 'busy-wait', format: 'chart.html', details: true }), Benchmark.save({ file: 'busy-wait', format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/deep-clone-object.mjs b/deep-clone-object.mjs index 9ed4037..8206cd9 100644 --- a/deep-clone-object.mjs +++ b/deep-clone-object.mjs @@ -41,6 +41,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/deep-merge-object.mjs b/deep-merge-object.mjs index eed7b10..cce9345 100644 --- a/deep-merge-object.mjs +++ b/deep-merge-object.mjs @@ -38,6 +38,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/empty-array.mjs b/empty-array.mjs index e53bfcc..12abb24 100644 --- a/empty-array.mjs +++ b/empty-array.mjs @@ -30,6 +30,6 @@ Benchmark.suite( Benchmark.save({ file: 'empty-array', format: 'json', details: true }), Benchmark.save({ file: 'empty-array', format: 'chart.html', details: true }), Benchmark.save({ file: 'empty-array', format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/fibonacci.mjs b/fibonacci.mjs index 700f3c0..00130ce 100644 --- a/fibonacci.mjs +++ b/fibonacci.mjs @@ -76,6 +76,6 @@ Benchmark.suite( Benchmark.save({ file: 'fibonacci', format: 'json', details: true }), Benchmark.save({ file: 'fibonacci', format: 'chart.html', details: true }), Benchmark.save({ file: 'fibonacci', format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/is-empty-object.mjs b/is-empty-object.mjs index f718ada..b4ba3cb 100644 --- a/is-empty-object.mjs +++ b/is-empty-object.mjs @@ -36,6 +36,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/is-undefined.mjs b/is-undefined.mjs index caf2bba..a04113b 100644 --- a/is-undefined.mjs +++ b/is-undefined.mjs @@ -25,6 +25,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/max.mjs b/max.mjs index 8914520..60fcdea 100644 --- a/max.mjs +++ b/max.mjs @@ -69,6 +69,6 @@ Benchmark.suite( Benchmark.save({ file: 'max', format: 'json', details: true }), Benchmark.save({ file: 'max', format: 'chart.html', details: true }), Benchmark.save({ file: 'max', format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/min.mjs b/min.mjs index 2ac02b5..2561820 100644 --- a/min.mjs +++ b/min.mjs @@ -69,6 +69,6 @@ Benchmark.suite( Benchmark.save({ file: 'min', format: 'json', details: true }), Benchmark.save({ file: 'min', format: 'chart.html', details: true }), Benchmark.save({ file: 'min', format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/package.json b/package.json index 7f874d0..73ac989 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "benchmark:fibonacci": "node fibonacci.mjs", "benchmark:random": "node random.mjs", "benchmark:uuid-generator": "node uuid-generator.mjs", - "format": "rome format . --write; standard . --fix", + "format": "biome format . --write; standard . --fix", "lint": "eslint . --cache", "lint:fix": "eslint . --cache --fix", "test": "echo \"Error: no test specified\" && exit 1" @@ -69,6 +69,7 @@ "uuid": "^9.0.0" }, "devDependencies": { + "@biomejs/biome": "^1.1.2", "eslint": "^8.48.0", "eslint-config-standard": "^17.1.0", "eslint-define-config": "^1.23.0", @@ -79,7 +80,6 @@ "husky": "^8.0.3", "lint-staged": "^14.0.1", "prettier": "^3.0.3", - "rome": "^12.1.3", "standard": "^17.1.0", "typescript": "^5.2.2" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ebd773a..8f6e52c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,6 +34,9 @@ dependencies: version: 9.0.0 devDependencies: + '@biomejs/biome': + specifier: ^1.1.2 + version: 1.1.2 eslint: specifier: ^8.48.0 version: 8.48.0 @@ -64,9 +67,6 @@ devDependencies: prettier: specifier: ^3.0.3 version: 3.0.3 - rome: - specifier: ^12.1.3 - version: 12.1.3 standard: specifier: ^17.1.0 version: 17.1.0 @@ -110,6 +110,74 @@ packages: fast-deep-equal: 3.1.3 dev: false + /@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 + /@es-joy/jsdoccomment@0.40.1: resolution: {integrity: sha512-YORCdZSusAlBrFpZ77pJjc5r1bQs5caPWtAu+WWmiSo+8XaUzseapVrfAtiRFbQWnrBxxLLEwF6f6ZG/UgCQCg==} engines: {node: '>=16'} @@ -197,54 +265,6 @@ packages: fastq: 1.15.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 - /@types/json5@0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true @@ -354,8 +374,8 @@ packages: es-shim-unscopables: 1.0.0 dev: true - /array.prototype.flatmap@1.3.1: - resolution: {integrity: sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==} + /array.prototype.flatmap@1.3.2: + resolution: {integrity: sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==} engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 @@ -364,8 +384,8 @@ packages: es-shim-unscopables: 1.0.0 dev: true - /array.prototype.tosorted@1.1.1: - resolution: {integrity: sha512-pZYPXPRl2PqWcsUs6LOMn+1f1532nEoPTYowBtqLwAW+W8vSVhkIGnmOX1t/UQjD6YGI0vcD2B1U7ZFGQH9jnQ==} + /array.prototype.tosorted@1.1.2: + resolution: {integrity: sha512-HuQCHOlk1Weat5jzStICBCd83NxiIMwqDg/dHEsoefabn/hJRj5pVdWcPUSpRrwhwxZOsQassMpgN/xRYFBMIg==} dependencies: call-bind: 1.0.2 define-properties: 1.2.0 @@ -657,8 +677,8 @@ packages: regexp.prototype.flags: 1.5.0 safe-array-concat: 1.0.1 safe-regex-test: 1.0.0 - string.prototype.trim: 1.2.7 - string.prototype.trimend: 1.0.6 + string.prototype.trim: 1.2.8 + string.prototype.trimend: 1.0.7 string.prototype.trimstart: 1.0.7 typed-array-buffer: 1.0.0 typed-array-byte-length: 1.0.0 @@ -834,7 +854,7 @@ packages: array-includes: 3.1.7 array.prototype.findlastindex: 1.2.3 array.prototype.flat: 1.3.2 - array.prototype.flatmap: 1.3.1 + array.prototype.flatmap: 1.3.2 debug: 3.2.7 doctrine: 2.1.0 eslint: 8.48.0 @@ -925,8 +945,8 @@ packages: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 dependencies: array-includes: 3.1.7 - array.prototype.flatmap: 1.3.1 - array.prototype.tosorted: 1.1.1 + array.prototype.flatmap: 1.3.2 + array.prototype.tosorted: 1.1.2 doctrine: 2.1.0 es-iterator-helpers: 1.0.14 eslint: 8.48.0 @@ -2133,20 +2153,6 @@ packages: glob: 7.2.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-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -2301,8 +2307,8 @@ packages: side-channel: 1.0.4 dev: true - /string.prototype.trim@1.2.7: - resolution: {integrity: sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==} + /string.prototype.trim@1.2.8: + resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 @@ -2310,8 +2316,8 @@ packages: es-abstract: 1.22.1 dev: true - /string.prototype.trimend@1.0.6: - resolution: {integrity: sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==} + /string.prototype.trimend@1.0.7: + resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} dependencies: call-bind: 1.0.2 define-properties: 1.2.0 diff --git a/promise-handling.mjs b/promise-handling.mjs index ffb42ff..b3b0210 100644 --- a/promise-handling.mjs +++ b/promise-handling.mjs @@ -4,7 +4,7 @@ import Benchmark from 'benny' * */ function promise () { - return new Promise((resolve) => { + return new Promise(resolve => { resolve() }) } @@ -27,10 +27,10 @@ Benchmark.suite( }), Benchmark.add('promise with then().catch()', () => { asyncFunction() - .then((r) => { + .then(r => { return r }) - .catch((e) => { + .catch(e => { console.error(e) }) }), @@ -58,6 +58,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/quick-select.mjs b/quick-select.mjs index 09251a3..3823448 100644 --- a/quick-select.mjs +++ b/quick-select.mjs @@ -264,6 +264,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/random.mjs b/random.mjs index d59c813..e1062c0 100644 --- a/random.mjs +++ b/random.mjs @@ -100,6 +100,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/shallow-clone-object.mjs b/shallow-clone-object.mjs index 18cf151..830a386 100644 --- a/shallow-clone-object.mjs +++ b/shallow-clone-object.mjs @@ -33,6 +33,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) diff --git a/uuid-generator.mjs b/uuid-generator.mjs index f99c338..92e15d8 100644 --- a/uuid-generator.mjs +++ b/uuid-generator.mjs @@ -27,6 +27,6 @@ Benchmark.suite( format: 'table.html', details: true }) -).catch((err) => { +).catch(err => { console.error(err) }) -- 2.34.1