From a5efc47da25a0b870483a033b157d8e18cf7ae6c Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Thu, 19 Oct 2023 11:52:01 +0200 Subject: [PATCH] chore(deps): upgrade biome and esbuild - Fix reported code - Disable `noUselessLoneBlockStatemens` --- biome.json | 7 +- package-lock.json | 244 ++++++++++++++++--------------- package.json | 4 +- src/ast/bare-ast.ts | 3 +- src/ast/bare-semantic-checker.ts | 9 +- src/generator/bare-ast-utils.ts | 3 +- src/generator/js-generator.ts | 33 ++--- src/parser/bare-lexer.ts | 7 +- src/parser/bare-parser.ts | 6 +- 9 files changed, 162 insertions(+), 154 deletions(-) diff --git a/biome.json b/biome.json index 73061863..fa749b05 100644 --- a/biome.json +++ b/biome.json @@ -7,9 +7,12 @@ "linter": { "rules": { "all": true, + "complexity": { + "noExcessiveCognitiveComplexity": "off" + }, "nursery": { "all": true, - "noExcessiveComplexity": "off", + "noUselessLoneBlockStatements": "off", "useImportRestrictions": "off" }, "style": { @@ -19,7 +22,7 @@ }, "javascript": { "formatter": { - "indentSize": 4, + "indentWidth": 4, "semicolons": "asNeeded" } }, diff --git a/package-lock.json b/package-lock.json index 95de76cf..2b33602f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,9 +16,9 @@ }, "devDependencies": { "@bare-ts/lib": "~0.4.0", - "@biomejs/biome": "1.2.1", + "@biomejs/biome": "1.3.0", "@types/node": "16.9.6", - "esbuild": "0.19.3", + "esbuild": "0.19.5", "oletus": "4.0.0", "rome": "12.1.3", "typescript": "5.2.2", @@ -41,9 +41,9 @@ } }, "node_modules/@biomejs/biome": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.2.1.tgz", - "integrity": "sha512-olT0ldjncEQx+mtVLJ1LwJikrDtMYZakJ8dIMYXEoX9t10xjKpeY4OyKBa9Os8/EUHah9YmpYL64hQooza3WrA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.3.0.tgz", + "integrity": "sha512-IKe8eGhiW5PfD4B3GMerS9YucvL1cqEqocVdeBi/Q8o63znqy7aLU2Xc4DAw1qg9OurWxemAp2RQorSqYHwMow==", "dev": true, "hasInstallScript": true, "bin": { @@ -52,19 +52,23 @@ "engines": { "node": ">=14.*" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.2.1", - "@biomejs/cli-darwin-x64": "1.2.1", - "@biomejs/cli-linux-arm64": "1.2.1", - "@biomejs/cli-linux-x64": "1.2.1", - "@biomejs/cli-win32-arm64": "1.2.1", - "@biomejs/cli-win32-x64": "1.2.1" + "@biomejs/cli-darwin-arm64": "1.3.0", + "@biomejs/cli-darwin-x64": "1.3.0", + "@biomejs/cli-linux-arm64": "1.3.0", + "@biomejs/cli-linux-x64": "1.3.0", + "@biomejs/cli-win32-arm64": "1.3.0", + "@biomejs/cli-win32-x64": "1.3.0" } }, "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.2.1.tgz", - "integrity": "sha512-lz/Hn/isGnnZqILhnPiwO3Hy4mhGr1APrjXkCBolONyYG67x1OT3l8T5yaNW62GsIEeblabWkwLl/MkoPJJXZQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.3.0.tgz", + "integrity": "sha512-O2NhR3ZXw1QknvoKAxwn76U9q/RYvLsZwbYl6+iY79gnL2SL1bljuFMUzRS5R1nNs3H/LOrHUq/JpleKjOwGUw==", "cpu": [ "arm64" ], @@ -78,9 +82,9 @@ } }, "node_modules/@biomejs/cli-darwin-x64": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.2.1.tgz", - "integrity": "sha512-mWJE2+sPiHJk0kHkuHby9ssTm2WR/R7USwJbbNmy7PM07DZdcciF2XbyLofO2ZGh0QI0LEW59OcjMwYChQnZbA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.3.0.tgz", + "integrity": "sha512-8rljS+4nLVuSPuPmuFp64bMZqwmGv9O/6wKoVk0kzeaVD1elSzMz+ZoTrRodbI1Hl8kItDdGf431L7S1EqRokQ==", "cpu": [ "x64" ], @@ -94,9 +98,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.2.1.tgz", - "integrity": "sha512-M81if0mY66Feq3nsOoNRa+o57k6YecCeH4EX2EqkU/ObqYfVLmWnIvFsgqEZE/e/bguNmqBoAIJaIV26PvyyJg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.3.0.tgz", + "integrity": "sha512-vQIEaXQf1pPJPetcd4jfM3118sG4AfZvbDuLnU/4lCUIs0XuwPYMcx2KzwXu2m0tn6J4xQsZHvNQyHpiBbp9vA==", "cpu": [ "arm64" ], @@ -110,9 +114,9 @@ } }, "node_modules/@biomejs/cli-linux-x64": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.2.1.tgz", - "integrity": "sha512-gzTpmpvBmSFu6oeUeFKP8C34WpV91rha4gS+3swAuw5G+C4PosOTpAVPKnElbgl9iS0+stfP73tXARQUXySDPA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.3.0.tgz", + "integrity": "sha512-ZH+PvgAZ3nr69O8Tb+MO+08k+0PhG0paWhkIaUW1AUlD7ruIpk+dlHp3DjHauSPFDZkNIxj6utwI1c5lP8hF9w==", "cpu": [ "x64" ], @@ -126,9 +130,9 @@ } }, "node_modules/@biomejs/cli-win32-arm64": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.2.1.tgz", - "integrity": "sha512-SveEeHYjiXzRZhTE3HyURQ+CyZ3yLeKHUrggH4bSDQ1+b7rgDEF/XIEgMl+/3SWFlc+HdEpgbJWWZQCfSCqxww==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.3.0.tgz", + "integrity": "sha512-Mfo1oWXnuOL4zWidx0A7jQSs6+uZZYZB4wuD9lBCbuoQoRNFobGEs11z/iy8XW5mucx+MW4ylTAcDAS+5/2kEw==", "cpu": [ "arm64" ], @@ -142,9 +146,9 @@ } }, "node_modules/@biomejs/cli-win32-x64": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.2.1.tgz", - "integrity": "sha512-ooEjE+A6kbQhf0cPNvC8bXje1jk2uKWgJ8S3DgHZRBvr6DlBiUsU8C1ycURdhDiHZ5d6nOI98LFrj3WWR1ODzA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.3.0.tgz", + "integrity": "sha512-t2EPg+zeMzimBoURfj9CKeNObCZ/MbFxdQj0+K5Q+LR41fUaevG/wOrM+Swh5emRXdSBUm0qsTq3xiyv77C3Ww==", "cpu": [ "x64" ], @@ -158,9 +162,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.3.tgz", - "integrity": "sha512-Lemgw4io4VZl9GHJmjiBGzQ7ONXRfRPHcUEerndjwiSkbxzrpq0Uggku5MxxrXdwJ+pTj1qyw4jwTu7hkPsgIA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", + "integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==", "cpu": [ "arm" ], @@ -174,9 +178,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.3.tgz", - "integrity": "sha512-w+Akc0vv5leog550kjJV9Ru+MXMR2VuMrui3C61mnysim0gkFCPOUTAfzTP0qX+HpN9Syu3YA3p1hf3EPqObRw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz", + "integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==", "cpu": [ "arm64" ], @@ -190,9 +194,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.3.tgz", - "integrity": "sha512-FKQJKkK5MXcBHoNZMDNUAg1+WcZlV/cuXrWCoGF/TvdRiYS4znA0m5Il5idUwfxrE20bG/vU1Cr5e1AD6IEIjQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz", + "integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==", "cpu": [ "x64" ], @@ -206,9 +210,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.3.tgz", - "integrity": "sha512-kw7e3FXU+VsJSSSl2nMKvACYlwtvZB8RUIeVShIEY6PVnuZ3c9+L9lWB2nWeeKWNNYDdtL19foCQ0ZyUL7nqGw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz", + "integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==", "cpu": [ "arm64" ], @@ -222,9 +226,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.3.tgz", - "integrity": "sha512-tPfZiwF9rO0jW6Jh9ipi58N5ZLoSjdxXeSrAYypy4psA2Yl1dAMhM71KxVfmjZhJmxRjSnb29YlRXXhh3GqzYw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz", + "integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==", "cpu": [ "x64" ], @@ -238,9 +242,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.3.tgz", - "integrity": "sha512-ERDyjOgYeKe0Vrlr1iLrqTByB026YLPzTytDTz1DRCYM+JI92Dw2dbpRHYmdqn6VBnQ9Bor6J8ZlNwdZdxjlSg==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz", + "integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==", "cpu": [ "arm64" ], @@ -254,9 +258,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.3.tgz", - "integrity": "sha512-nXesBZ2Ad1qL+Rm3crN7NmEVJ5uvfLFPLJev3x1j3feCQXfAhoYrojC681RhpdOph8NsvKBBwpYZHR7W0ifTTA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz", + "integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==", "cpu": [ "x64" ], @@ -270,9 +274,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.3.tgz", - "integrity": "sha512-zr48Cg/8zkzZCzDHNxXO/89bf9e+r4HtzNUPoz4GmgAkF1gFAFmfgOdCbR8zMbzFDGb1FqBBhdXUpcTQRYS1cQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz", + "integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==", "cpu": [ "arm" ], @@ -286,9 +290,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.3.tgz", - "integrity": "sha512-qXvYKmXj8GcJgWq3aGvxL/JG1ZM3UR272SdPU4QSTzD0eymrM7leiZH77pvY3UetCy0k1xuXZ+VPvoJNdtrsWQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz", + "integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==", "cpu": [ "arm64" ], @@ -302,9 +306,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.3.tgz", - "integrity": "sha512-7XlCKCA0nWcbvYpusARWkFjRQNWNGlt45S+Q18UeS///K6Aw8bB2FKYe9mhVWy/XLShvCweOLZPrnMswIaDXQA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz", + "integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==", "cpu": [ "ia32" ], @@ -318,9 +322,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.3.tgz", - "integrity": "sha512-qGTgjweER5xqweiWtUIDl9OKz338EQqCwbS9c2Bh5jgEH19xQ1yhgGPNesugmDFq+UUSDtWgZ264st26b3de8A==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz", + "integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==", "cpu": [ "loong64" ], @@ -334,9 +338,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.3.tgz", - "integrity": "sha512-gy1bFskwEyxVMFRNYSvBauDIWNggD6pyxUksc0MV9UOBD138dKTzr8XnM2R4mBsHwVzeuIH8X5JhmNs2Pzrx+A==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz", + "integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==", "cpu": [ "mips64el" ], @@ -350,9 +354,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.3.tgz", - "integrity": "sha512-UrYLFu62x1MmmIe85rpR3qou92wB9lEXluwMB/STDzPF9k8mi/9UvNsG07Tt9AqwPQXluMQ6bZbTzYt01+Ue5g==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz", + "integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==", "cpu": [ "ppc64" ], @@ -366,9 +370,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.3.tgz", - "integrity": "sha512-9E73TfyMCbE+1AwFOg3glnzZ5fBAFK4aawssvuMgCRqCYzE0ylVxxzjEfut8xjmKkR320BEoMui4o/t9KA96gA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz", + "integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==", "cpu": [ "riscv64" ], @@ -382,9 +386,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.3.tgz", - "integrity": "sha512-LlmsbuBdm1/D66TJ3HW6URY8wO6IlYHf+ChOUz8SUAjVTuaisfuwCOAgcxo3Zsu3BZGxmI7yt//yGOxV+lHcEA==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz", + "integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==", "cpu": [ "s390x" ], @@ -398,9 +402,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.3.tgz", - "integrity": "sha512-ogV0+GwEmvwg/8ZbsyfkYGaLACBQWDvO0Kkh8LKBGKj9Ru8VM39zssrnu9Sxn1wbapA2qNS6BiLdwJZGouyCwQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz", + "integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==", "cpu": [ "x64" ], @@ -414,9 +418,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.3.tgz", - "integrity": "sha512-o1jLNe4uzQv2DKXMlmEzf66Wd8MoIhLNO2nlQBHLtWyh2MitDG7sMpfCO3NTcoTMuqHjfufgUQDFRI5C+xsXQw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz", + "integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==", "cpu": [ "x64" ], @@ -430,9 +434,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.3.tgz", - "integrity": "sha512-AZJCnr5CZgZOdhouLcfRdnk9Zv6HbaBxjcyhq0StNcvAdVZJSKIdOiPB9az2zc06ywl0ePYJz60CjdKsQacp5Q==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz", + "integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==", "cpu": [ "x64" ], @@ -446,9 +450,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.3.tgz", - "integrity": "sha512-Acsujgeqg9InR4glTRvLKGZ+1HMtDm94ehTIHKhJjFpgVzZG9/pIcWW/HA/DoMfEyXmANLDuDZ2sNrWcjq1lxw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz", + "integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==", "cpu": [ "x64" ], @@ -462,9 +466,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.3.tgz", - "integrity": "sha512-FSrAfjVVy7TifFgYgliiJOyYynhQmqgPj15pzLyJk8BUsnlWNwP/IAy6GAiB1LqtoivowRgidZsfpoYLZH586A==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz", + "integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==", "cpu": [ "arm64" ], @@ -478,9 +482,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.3.tgz", - "integrity": "sha512-xTScXYi12xLOWZ/sc5RBmMN99BcXp/eEf7scUC0oeiRoiT5Vvo9AycuqCp+xdpDyAU+LkrCqEpUS9fCSZF8J3Q==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz", + "integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==", "cpu": [ "ia32" ], @@ -494,9 +498,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.3.tgz", - "integrity": "sha512-FbUN+0ZRXsypPyWE2IwIkVjDkDnJoMJARWOcFZn4KPPli+QnKqF0z1anvfaYe3ev5HFCpRDLLBDHyOALLppWHw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz", + "integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==", "cpu": [ "x64" ], @@ -602,9 +606,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.3.tgz", - "integrity": "sha512-UlJ1qUUA2jL2nNib1JTSkifQTcYTroFqRjwCFW4QYEKEsixXD5Tik9xML7zh2gTxkYTBKGHNH9y7txMwVyPbjw==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz", + "integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -614,28 +618,28 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.19.3", - "@esbuild/android-arm64": "0.19.3", - "@esbuild/android-x64": "0.19.3", - "@esbuild/darwin-arm64": "0.19.3", - "@esbuild/darwin-x64": "0.19.3", - "@esbuild/freebsd-arm64": "0.19.3", - "@esbuild/freebsd-x64": "0.19.3", - "@esbuild/linux-arm": "0.19.3", - "@esbuild/linux-arm64": "0.19.3", - "@esbuild/linux-ia32": "0.19.3", - "@esbuild/linux-loong64": "0.19.3", - "@esbuild/linux-mips64el": "0.19.3", - "@esbuild/linux-ppc64": "0.19.3", - "@esbuild/linux-riscv64": "0.19.3", - "@esbuild/linux-s390x": "0.19.3", - "@esbuild/linux-x64": "0.19.3", - "@esbuild/netbsd-x64": "0.19.3", - "@esbuild/openbsd-x64": "0.19.3", - "@esbuild/sunos-x64": "0.19.3", - "@esbuild/win32-arm64": "0.19.3", - "@esbuild/win32-ia32": "0.19.3", - "@esbuild/win32-x64": "0.19.3" + "@esbuild/android-arm": "0.19.5", + "@esbuild/android-arm64": "0.19.5", + "@esbuild/android-x64": "0.19.5", + "@esbuild/darwin-arm64": "0.19.5", + "@esbuild/darwin-x64": "0.19.5", + "@esbuild/freebsd-arm64": "0.19.5", + "@esbuild/freebsd-x64": "0.19.5", + "@esbuild/linux-arm": "0.19.5", + "@esbuild/linux-arm64": "0.19.5", + "@esbuild/linux-ia32": "0.19.5", + "@esbuild/linux-loong64": "0.19.5", + "@esbuild/linux-mips64el": "0.19.5", + "@esbuild/linux-ppc64": "0.19.5", + "@esbuild/linux-riscv64": "0.19.5", + "@esbuild/linux-s390x": "0.19.5", + "@esbuild/linux-x64": "0.19.5", + "@esbuild/netbsd-x64": "0.19.5", + "@esbuild/openbsd-x64": "0.19.5", + "@esbuild/sunos-x64": "0.19.5", + "@esbuild/win32-arm64": "0.19.5", + "@esbuild/win32-ia32": "0.19.5", + "@esbuild/win32-x64": "0.19.5" } }, "node_modules/oletus": { diff --git a/package.json b/package.json index 97279a5d..20aada8b 100644 --- a/package.json +++ b/package.json @@ -65,9 +65,9 @@ }, "devDependencies": { "@bare-ts/lib": "~0.4.0", - "@biomejs/biome": "1.2.1", + "@biomejs/biome": "1.3.0", "@types/node": "16.9.6", - "esbuild": "0.19.3", + "esbuild": "0.19.5", "oletus": "4.0.0", "rome": "12.1.3", "typescript": "5.2.2", diff --git a/src/ast/bare-ast.ts b/src/ast/bare-ast.ts index fca89498..eb41872d 100644 --- a/src/ast/bare-ast.ts +++ b/src/ast/bare-ast.ts @@ -302,7 +302,8 @@ export function rootAliases(defs: readonly AliasedType[]): readonly string[] { function referredAliases(type: Type): readonly string[] { if (type.tag === "alias") { return [type.data] - } else if (type.types != null) { + } + if (type.types != null) { return type.types.flatMap((t) => referredAliases(t)) } return [] diff --git a/src/ast/bare-semantic-checker.ts b/src/ast/bare-semantic-checker.ts index 6c92585c..b1899bdc 100644 --- a/src/ast/bare-semantic-checker.ts +++ b/src/ast/bare-semantic-checker.ts @@ -295,7 +295,8 @@ function checkUsedBeforeDefined( `Alias '${type.data}' is used before its definition. To allow use-before-definition and recursive types set the option '--legacy'.`, type.offset, ) - } else if (type.types != null) { + } + if (type.types != null) { for (const subtype of type.types) { checkUsedBeforeDefined(c, subtype, defined) } @@ -313,7 +314,8 @@ function checkCircularRef( type.tag === "optional" ) { return // allowed circular refs - } else if (type.tag === "union") { + } + if (type.tag === "union") { let circularCount = 0 let firstError: CompilerError | null = null for (const subtype of type.types) { @@ -330,7 +332,8 @@ function checkCircularRef( throw firstError } return // allowed circular refs - } else if (type.tag === "struct" || type.tag === "list") { + } + if (type.tag === "struct" || type.tag === "list") { for (const subtype of type.types) { checkCircularRef(c, subtype, traversed) } diff --git a/src/generator/bare-ast-utils.ts b/src/generator/bare-ast-utils.ts index 7fe52c64..23196f63 100644 --- a/src/generator/bare-ast-utils.ts +++ b/src/generator/bare-ast-utils.ts @@ -43,7 +43,8 @@ function innerUnrecursive( const extra = type.extra if (simplified == null) { return { tag: "void", data: null, types: null, extra, offset: 0 } - } else if (type.types[0] !== simplified) { + } + if (type.types[0] !== simplified) { return simplifyOptional({ tag: "optional", data: null, diff --git a/src/generator/js-generator.ts b/src/generator/js-generator.ts index 859c1852..ced73712 100644 --- a/src/generator/js-generator.ts +++ b/src/generator/js-generator.ts @@ -129,7 +129,8 @@ function genAliasedType(g: Gen, aliased: ast.AliasedType): string { if (!isClass) { const structDef = genStructType(g, type) return `${doc}export type ${alias} = ${structDef}` - } else if (g.config.generator !== "dts") { + } + if (g.config.generator !== "dts") { return "" // A non-ambient class will be generated } return dent` @@ -174,9 +175,8 @@ function genType(g: Gen, type: ast.Type): string { } if (type.extra?.safe) { return `${type.tag}Safe` - } else { - return type.tag } + return type.tag } function genAliasType(g: Gen, type: ast.Alias): string { @@ -193,11 +193,11 @@ function genListType(g: Gen, type: ast.ListType): string { const typedArray = ast.FIXED_NUMERIC_TYPE_TO_TYPED_ARRAY.get(valType.tag) if (type.extra?.typedArray && typedArray != null) { return global(g, typedArray) - } else if (type.extra?.unique) { + } + if (type.extra?.unique) { return genSetType(g, type) - } else { - return genListRawType(g, type) } + return genListRawType(g, type) } function genListRawType(g: Gen, type: ast.ListType): string { @@ -242,9 +242,8 @@ function genOptionalType(g: Gen, type: ast.OptionalType): string { if (simplified.tag === "optional") { const typedef = genType(g, simplified.types[0]) return `${typedef} | ${noneVal(simplified)}` - } else { - return genType(g, simplified) } + return genType(g, simplified) } function genMapType(g: Gen, type: ast.MapType): string { @@ -467,19 +466,18 @@ function genReader(g: Gen, type: ast.Type, alias = ""): string { } if (type.extra?.safe) { return `(bare.read${capitalize(type.tag)}Safe(bc))` - } else { - return `(bare.read${capitalize(type.tag)}(bc))` } + return `(bare.read${capitalize(type.tag)}(bc))` } function genListReader(g: Gen, type: ast.ListType): string { if (type.extra?.typedArray) { return genTypedArrayReader(g, type) - } else if (type.extra?.unique) { + } + if (type.extra?.unique) { return genSetReader(g, type) - } else { - return genListRawReader(g, type) } + return genListRawReader(g, type) } function genListRawReader(g: Gen, type: ast.ListType): string { @@ -767,19 +765,18 @@ function genWriter(g: Gen, type: ast.Type, alias = ""): string { } if (type.extra?.safe) { return `(bare.write${capitalize(type.tag)}Safe(bc, $x))` - } else { - return `(bare.write${capitalize(type.tag)}(bc, $x))` } + return `(bare.write${capitalize(type.tag)}(bc, $x))` } function genListWriter(g: Gen, type: ast.ListType): string { if (type.extra?.typedArray) { return genTypedArrayWriter(g, type) - } else if (type.extra?.unique) { + } + if (type.extra?.unique) { return genSetWriter(g, type) - } else { - return genListRawWriter(g, type) } + return genListRawWriter(g, type) } function genListRawWriter(g: Gen, type: ast.ListType): string { diff --git a/src/parser/bare-lexer.ts b/src/parser/bare-lexer.ts index a4f323da..06d15d64 100644 --- a/src/parser/bare-lexer.ts +++ b/src/parser/bare-lexer.ts @@ -77,10 +77,11 @@ export function nextToken(lex: Lexer): void { } } offset++ - } else if (PUNCTUATION_PATTERN.test(c)) { - token = c - break } else { + if (PUNCTUATION_PATTERN.test(c)) { + token = c + break + } const suffix = content.slice(offset) const match = suffix.match(ID_PATTERN) if (match == null) { diff --git a/src/parser/bare-parser.ts b/src/parser/bare-parser.ts index 6ceed2ea..b0fc2a17 100644 --- a/src/parser/bare-parser.ts +++ b/src/parser/bare-parser.ts @@ -119,9 +119,8 @@ function parseTypeName(p: Parser): ast.Type { const tag = alias === "string" ? "str" : alias if (ast.isBaseTag(tag) || tag === "void") { return { tag, data: null, types: null, extra: null, offset } - } else { - return { tag: "alias", data: alias, types: null, extra: null, offset } } + return { tag: "alias", data: alias, types: null, extra: null, offset } } function parseData(p: Parser): ast.Type { @@ -379,9 +378,8 @@ function parseOptionalLength(p: Parser): ast.Length | null { const val = parseUnsignedNumber(p) expect(p, "]") return { name: null, val, comment: null, extra: null, offset } - } else { - return null } + return null } function parseTypeParameter(p: Parser): ast.Type {