chore: use biome instead of rome
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 8 Sep 2023 10:45:59 +0000 (12:45 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 8 Sep 2023 10:45:59 +0000 (12:45 +0200)
https://biomejs.dev/blog/biome-v1

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
19 files changed:
.lintstagedrc.js
benchmark-utils.mjs
biome.json [moved from rome.json with 68% similarity]
busy-wait.mjs
deep-clone-object.mjs
deep-merge-object.mjs
empty-array.mjs
fibonacci.mjs
is-empty-object.mjs
is-undefined.mjs
max.mjs
min.mjs
package.json
pnpm-lock.yaml
promise-handling.mjs
quick-select.mjs
random.mjs
shallow-clone-object.mjs
uuid-generator.mjs

index d0c795d385456319b9d875fd3ebbeb4978e618e6..b31b961307b842034b5cd1b66ff5adba150d8fec 100644 (file)
@@ -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']
 }
index d3757b5ef619adfee8d0c3a48e93a5012b319529..e914e6b20337bf26b8aa58a8e4017ea834458fc8 100644 (file)
@@ -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))
 }
similarity index 68%
rename from rome.json
rename to biome.json
index d45bc64a3fd78681dfb89785b19b16b580e2da0c..ce653d378befb9eb99dbf936527249743ac077e9 100644 (file)
--- a/rome.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
   },
     "formatter": {
       "quoteStyle": "single",
       "trailingComma": "none",
-      "semicolons": "asNeeded"
+      "semicolons": "asNeeded",
+      "arrowParentheses": "asNeeded"
+    }
+  },
+  "json": {
+    "parser": {
+      "allowComments": true
     }
   },
   "files": {
index 2add04648a4190d2f787c1341c1a845475c38bc8..dd8a74f5a5c2faa69c3310b718d4542b1d7d614c 100644 (file)
@@ -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)
 })
index 9ed4037324d5507c23f5443021385998346e9d74..8206cd9948a0997160f7986193939d74ca001e7a 100644 (file)
@@ -41,6 +41,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })
index eed7b10b68ce516727b9658e3c9fd7d30fea2b0f..cce9345231259cf281c95c35d718178c59436048 100644 (file)
@@ -38,6 +38,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })
index e53bfcc3f20e2cb8a801940c738d0d0b310e54e1..12abb24b002080efea1ab068a414a16080ec5f52 100644 (file)
@@ -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)
 })
index 700f3c0579bba560fdc39d899f388d6505c8320a..00130ce0709a7e33a6abb23ba24bbed6fcfcbb8b 100644 (file)
@@ -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)
 })
index f718ada861751e905e11756ff83d79d5aacc834f..b4ba3cbb8f8faa8a4fbe61d930b29618c03513b3 100644 (file)
@@ -36,6 +36,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })
index caf2bba4e5bd3842e163099aebaffa8607e2019f..a04113b881ac45a17a638c24ab1dd0d401fb5650 100644 (file)
@@ -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 8914520e21c75b7e2ee5d50b41ea80a1f310b142..60fcdeac0764ba2016cd71050b94e27f228499f3 100644 (file)
--- 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 2ac02b52bb9b9a0a4972b3a307779a11c4d5e343..25618206a0e12514dbb665a2f468654d3ac34205 100644 (file)
--- 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)
 })
index 7f874d0847c60ae61afe4f83cad455c65c9feca0..73ac98913c33d2a010715c74365166b8712705df 100644 (file)
@@ -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"
   }
index ebd773acd54cfb8cbb7846317f01e902aba3c301..8f6e52cacd2dbb6c5c7a9388b51a2a2048a069ca 100644 (file)
@@ -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
index ffb42ff96861de27332160a9748cbecf1e8755da..b3b02107c9cfc793a7c3149db013236df206b8bb 100644 (file)
@@ -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)
 })
index 09251a3ce395b1c43f70768f7a7d73262da56d61..3823448ee9faa1ecd2891327d2a9dc0534ed7469 100644 (file)
@@ -264,6 +264,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })
index d59c81359809a995111ba10bab27ef4874a8bd8b..e1062c05c7e4a4d17749645af4d8a271ac0fd547 100644 (file)
@@ -100,6 +100,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })
index 18cf151259a692cc3f1321217ffc8554aa67bcbc..830a3862f3c1e3712cf9ed56a2a296dab49a963e 100644 (file)
@@ -33,6 +33,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })
index f99c33864c31fcacef499a0455eba02ba74340fe..92e15d848468cc576ed91f7d06ba4d134a4ad041 100644 (file)
@@ -27,6 +27,6 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch((err) => {
+).catch(err => {
   console.error(err)
 })