diff --git a/package.json b/package.json index 8721c59..3427bbb 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "eslint-config-prettier": "^10.1.8", "eslint-import-resolver-typescript": "^4.4.4", "eslint-plugin-import-x": "^4.16.2", - "eslint-plugin-unicorn": "^74.0.0", + "eslint-plugin-unicorn": "^75.0.0", "husky": "^9.1.7", "lint-staged": "^17.0.5", "prettier": "^3.8.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8cb1659..b50dc5d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -46,8 +46,8 @@ importers: specifier: ^4.16.2 version: 4.17.1(@typescript-eslint/utils@8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0))(eslint@10.10.0) eslint-plugin-unicorn: - specifier: ^74.0.0 - version: 74.0.0(eslint@10.10.0) + specifier: ^75.0.0 + version: 75.0.0(eslint@10.10.0) husky: specifier: ^9.1.7 version: 9.1.7 @@ -136,8 +136,8 @@ packages: resolution: {integrity: sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} - '@eslint/css-tree@4.0.5': - resolution: {integrity: sha512-iPmijIAq4hlIJB86PYmY/fcZORHtjphSqICDbwuw32A/JmkhZQ/K/6TjHE03zqf3n5yABpVcbRAMG8Mi9ojy8g==} + '@eslint/css-tree@4.1.0': + resolution: {integrity: sha512-cg0ohyrAG3swyGqt8t1K/OK97DqBw/ftDvlvyY1fmEst5B40UOmsimwLENq74z2dyw5CDM+3zJIW+CV2nFNDdA==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} '@eslint/js@10.0.1': @@ -1004,8 +1004,8 @@ packages: resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} engines: {node: 18 || 20 || >=22} - baseline-browser-mapping@2.11.20: - resolution: {integrity: sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==} + baseline-browser-mapping@2.11.24: + resolution: {integrity: sha512-hYrgxie335U08WqICoGqKRzV1HFXv6zdxwJE4ekCb80CM9a0SVVsN4QPwT67RraRo+9h8IATk6uxHJw7QSkdOg==} engines: {node: '>=6.0.0'} hasBin: true @@ -1013,8 +1013,8 @@ packages: resolution: {integrity: sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==} engines: {node: 20 || >=22} - browserslist@4.28.8: - resolution: {integrity: sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==} + browserslist@4.29.0: + resolution: {integrity: sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true @@ -1047,10 +1047,6 @@ packages: resolution: {integrity: sha512-0h+uSNtQGW3D98eQt3jJ8L06Fves8hncB4V/PKdw/Qb8Hnk19VaKuTr55UNRYiSoVa7WwrFls+rh3ux9agmkeQ==} engines: {node: '>= 12.0.0'} - convert-hrtime@5.0.0: - resolution: {integrity: sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg==} - engines: {node: '>=12'} - core-js-compat@3.50.0: resolution: {integrity: sha512-XGpFGbMLHwSt74YLTKho7Ib242qi6O8MSX+sRokV4oz7iKXvQWGYZthjIhjRGMxjzVkAubBO512dKGYcefmX3Q==} engines: {node: '>=6.4.0'} @@ -1091,8 +1087,8 @@ packages: oxc-resolver: optional: true - electron-to-chromium@1.5.416: - resolution: {integrity: sha512-K6bvB2BjnNrugtIih6ewlbBI9DXa976jIdiIlRLHhBoEI9a4JaQjjHyF+A1IQI543aQYR4LnmOrT/K5fZj0aPA==} + electron-to-chromium@1.5.430: + resolution: {integrity: sha512-e1QEj72Y4zd8RlNZVmoTg+iCOSVwpk05IOiiQwdrkwCSVlZfPthevErhE+nckGd2YbsXfp1SkisznhGVIXP2NQ==} emittery@2.0.0: resolution: {integrity: sha512-FLtgn/CGBXiX3ZtPAm5q4LWWepHChOt55J9u01WFu3dyap2U7IwptlrqoE1COR/kxwdy/DOxIBALSxIW449I1g==} @@ -1106,8 +1102,8 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} - entities@8.0.0: - resolution: {integrity: sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==} + entities@8.1.0: + resolution: {integrity: sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==} engines: {node: '>=20.19.0'} es-module-lexer@2.3.2: @@ -1162,8 +1158,8 @@ packages: eslint-import-resolver-node: optional: true - eslint-plugin-unicorn@74.0.0: - resolution: {integrity: sha512-AGnsGi2SxHg1HEAXxn9nSnZfyjvTWkxm8E8hpd/9tD6dLjBUdcD7+D6ZN64HmmCXTSXlrwVyUqe20Uyb2CaurA==} + eslint-plugin-unicorn@75.0.0: + resolution: {integrity: sha512-72I7eSn+/z5CpgValFBl9mp2JE5UPD+nUUyB/VIGUMF1rCP1i37mA05zfIAVIU312A+qCZ38T8tSZr3oaMv4Mw==} engines: {node: '>=22'} peerDependencies: eslint: '>=10.4' @@ -1257,10 +1253,6 @@ packages: engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] - function-timeout@1.0.2: - resolution: {integrity: sha512-939eZS4gJ3htTHAldmyyuzlrD58P03fHG49v2JfFXbV6OhvZKRC9j2yAtdHw/zrp2zXHuv05zMIy40F0ge7spA==} - engines: {node: '>=18'} - get-tsconfig@4.14.0: resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==} @@ -1272,8 +1264,8 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - globals@17.11.0: - resolution: {integrity: sha512-Z2I8hM+PbJDXQDq3Icgpzv+mPdwr68iZUU9d5WW4FuXfDUQfkZaZuvjMv42/5crNyw154+9+VWXbYrUgDXbxNw==} + globals@17.12.0: + resolution: {integrity: sha512-cezEd/DTyyht9cvSSURyygXPfy04GtWO/5e6ZPvH7fCtjKz9PYOmuawphw1Ctd1f6C+5JypXfGD7ahNMXvevBA==} engines: {node: '>=18'} hashery@1.5.1: @@ -1333,10 +1325,6 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} - is-identifier@1.1.0: - resolution: {integrity: sha512-NhOds0mDx9lJu+1lBRO0xbwFo5nobA7GCk/0e5xjr6+6XugX985+0OyGX35BNrTkPAsdLcIKg02HUQJOK8D8kw==} - engines: {node: '>=18'} - isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -1456,16 +1444,12 @@ packages: magicast@0.5.5: resolution: {integrity: sha512-UicdXN8zQ3JHlxVq+28afMXPr1z7WNY6+7EJnzTdQWkTAlMLF5fNCCKxJHBQwGaNGR11581EiQmQzx73+MvszA==} - make-asynchronous@1.1.0: - resolution: {integrity: sha512-ayF7iT+44LXdxJLTrTd3TLQpFDDvPCBxXxbv+pMUSuHA5Q8zyAfwkRP6aHHwNVFBUFWtxAHqwNJxF8vMZLAbVg==} - engines: {node: '>=18'} - markdown-it@14.3.0: resolution: {integrity: sha512-RCEsPjR+sr0x+AuYp601tKTkgFG4YEPLCzHST3cQ/fhlJkqAkz1L2/Qbp1j9qw5SBwQHFBoW8+hoN5xssOF0Tw==} hasBin: true - mdn-data@2.29.0: - resolution: {integrity: sha512-pVxQFCcaYUEAH853+v7yoI/qzhxXSq1bTb9obMYGYAN1c3Hen+XDCEvr296XhstrwlSTNgOR7mCSD4JPjbJe5A==} + mdn-data@2.34.0: + resolution: {integrity: sha512-OgIlLv0NxJKVW4GTSAoEgpRGd4F2XCqGinK0MsMlBCCS/Zcm2/LsbercNWNA7PeMMcjl75NnI97eqyo7zkdxWA==} mdurl@2.0.0: resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} @@ -1494,8 +1478,8 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} - node-releases@2.0.54: - resolution: {integrity: sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==} + node-releases@2.0.55: + resolution: {integrity: sha512-mIrE/Cw9y+9Au6dS5vDKDhQza9YvG6w+ZrS6X+ZzA7yFW/soAeaups4Qzn1bL6g5FVy8WtP79+0j82oPIbqRjQ==} engines: {node: '>=18'} obug@2.1.4: @@ -1510,10 +1494,6 @@ packages: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} - p-event@6.0.1: - resolution: {integrity: sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w==} - engines: {node: '>=16.17'} - p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -1522,10 +1502,6 @@ packages: resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} engines: {node: '>=10'} - p-timeout@6.1.4: - resolution: {integrity: sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==} - engines: {node: '>=14.16'} - path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -1655,14 +1631,6 @@ packages: resolution: {integrity: sha512-SlyRoSkdh1dYP0PzclLE7r0M9sgbFKKMFXpFRUMNuKhQSbC6VQIGzq3E0qsfvGJaUFJPGv6Ws1NZ/haTAjfbMA==} engines: {node: '>=12'} - super-regex@1.1.0: - resolution: {integrity: sha512-WHkws2ZflZe41zj6AolvvmaTrWds/VuyeYr9iPVv/oQeaIoVxMKaushfFWpOGDT+GuBrM/sVqF8KUCYQlSSTdQ==} - engines: {node: '>=18'} - - time-span@5.1.0: - resolution: {integrity: sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA==} - engines: {node: '>=12'} - tinybench@6.1.4: resolution: {integrity: sha512-9APumHG7r4yOk4X4WlkmE71aZcv1gvin1czO3OQ1U9iJcFA5Ja/ygyb0vPOVHTthFozUYs8CLoLUlM8grb2lTQ==} engines: {node: '>=20.0.0'} @@ -1734,10 +1702,6 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - type-fest@4.41.0: - resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} - engines: {node: '>=16'} - typedoc@0.28.20: resolution: {integrity: sha512-uSKqkh8Cr48vllnEy+jdaAgOeR6Y+QCBW7usgUsKj7gJEfR7stw9U/fE49LBnj2tPRKPY0c0EBJSWe9Appmplg==} engines: {node: '>= 18', pnpm: '>= 10'} @@ -1774,8 +1738,8 @@ packages: unrs-resolver@1.12.2: resolution: {integrity: sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==} - update-browserslist-db@1.3.2: - resolution: {integrity: sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==} + update-browserslist-db@1.3.3: + resolution: {integrity: sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' @@ -1871,9 +1835,6 @@ packages: jsdom: optional: true - web-worker@1.5.0: - resolution: {integrity: sha512-RiMReJrTAiA+mBjGONMnjVDP2u3p9R1vkcGz6gDIrOMT3oGuYwX2WRMYI9ipkphSuE5XKEhydbhNEJh4NY9mlw==} - which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -1893,6 +1854,11 @@ packages: engines: {node: '>= 14.6'} hasBin: true + yaml@2.9.1: + resolution: {integrity: sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==} + engines: {node: '>= 14.6'} + hasBin: true + yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -1977,9 +1943,9 @@ snapshots: dependencies: '@types/json-schema': 7.0.15 - '@eslint/css-tree@4.0.5': + '@eslint/css-tree@4.1.0': dependencies: - mdn-data: 2.29.0 + mdn-data: 2.34.0 source-map-js: 1.2.1 '@eslint/js@10.0.1(eslint@10.10.0)': @@ -2607,19 +2573,19 @@ snapshots: balanced-match@4.0.4: {} - baseline-browser-mapping@2.11.20: {} + baseline-browser-mapping@2.11.24: {} brace-expansion@5.0.9: dependencies: balanced-match: 4.0.4 - browserslist@4.28.8: + browserslist@4.29.0: dependencies: - baseline-browser-mapping: 2.11.20 + baseline-browser-mapping: 2.11.24 caniuse-lite: 1.0.30001810 - electron-to-chromium: 1.5.416 - node-releases: 2.0.54 - update-browserslist-db: 1.3.2(browserslist@4.28.8) + electron-to-chromium: 1.5.430 + node-releases: 2.0.55 + update-browserslist-db: 1.3.3(browserslist@4.29.0) builtin-modules@5.3.0: {} @@ -2643,11 +2609,9 @@ snapshots: comment-parser@1.4.7: {} - convert-hrtime@5.0.0: {} - core-js-compat@3.50.0: dependencies: - browserslist: 4.28.8 + browserslist: 4.29.0 cross-spawn@7.0.6: dependencies: @@ -2669,7 +2633,7 @@ snapshots: dts-resolver@3.0.0: {} - electron-to-chromium@1.5.416: {} + electron-to-chromium@1.5.430: {} emittery@2.0.0: {} @@ -2677,7 +2641,7 @@ snapshots: entities@4.5.0: {} - entities@8.0.0: {} + entities@8.1.0: {} es-module-lexer@2.3.2: {} @@ -2728,29 +2692,29 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-unicorn@74.0.0(eslint@10.10.0): + eslint-plugin-unicorn@75.0.0(eslint@10.10.0): dependencies: '@eslint-community/eslint-utils': 4.10.1(eslint@10.10.0) - '@eslint/css-tree': 4.0.5 - browserslist: 4.28.8 + '@eslint/css-tree': 4.1.0 + browserslist: 4.29.0 change-case: 5.4.4 ci-info: 4.4.0 core-js-compat: 3.50.0 detect-indent: 7.0.2 - entities: 8.0.0 + entities: 8.1.0 eslint: 10.10.0 find-up-simple: 1.0.1 - globals: 17.11.0 + globals: 17.12.0 + identifier-regex: 1.1.0 indent-string: 5.0.0 is-builtin-module: 5.0.0 - is-identifier: 1.1.0 pluralize: 8.0.0 quote-js-string: 0.1.0 regjsparser: 0.13.2 reserved-identifiers: 1.2.0 semver: 7.8.5 strip-indent: 4.1.1 - yaml: 2.9.0 + yaml: 2.9.1 eslint-scope@9.1.2: dependencies: @@ -2854,8 +2818,6 @@ snapshots: fsevents@2.3.3: optional: true - function-timeout@1.0.2: {} - get-tsconfig@4.14.0: dependencies: resolve-pkg-maps: 1.0.0 @@ -2868,7 +2830,7 @@ snapshots: dependencies: is-glob: 4.0.3 - globals@17.11.0: {} + globals@17.12.0: {} hashery@1.5.1: dependencies: @@ -2910,11 +2872,6 @@ snapshots: dependencies: is-extglob: 2.1.1 - is-identifier@1.1.0: - dependencies: - identifier-regex: 1.1.0 - super-regex: 1.1.0 - isexe@2.0.0: {} js-tokens@10.0.0: {} @@ -3011,12 +2968,6 @@ snapshots: '@babel/types': 7.29.7 source-map-js: 1.2.1 - make-asynchronous@1.1.0: - dependencies: - p-event: 6.0.1 - type-fest: 4.41.0 - web-worker: 1.5.0 - markdown-it@14.3.0: dependencies: argparse: 2.0.1 @@ -3026,7 +2977,7 @@ snapshots: punycode.js: 2.3.1 uc.micro: 2.1.0 - mdn-data@2.29.0: {} + mdn-data@2.34.0: {} mdurl@2.0.0: {} @@ -3046,7 +2997,7 @@ snapshots: natural-compare@1.4.0: {} - node-releases@2.0.54: {} + node-releases@2.0.55: {} obug@2.1.4: {} @@ -3061,10 +3012,6 @@ snapshots: type-check: 0.4.0 word-wrap: 1.2.5 - p-event@6.0.1: - dependencies: - p-timeout: 6.1.4 - p-limit@3.1.0: dependencies: yocto-queue: 0.1.0 @@ -3073,8 +3020,6 @@ snapshots: dependencies: p-limit: 3.1.0 - p-timeout@6.1.4: {} - path-exists@4.0.0: {} path-key@3.1.1: {} @@ -3193,16 +3138,6 @@ snapshots: strip-indent@4.1.1: {} - super-regex@1.1.0: - dependencies: - function-timeout: 1.0.2 - make-asynchronous: 1.1.0 - time-span: 5.1.0 - - time-span@5.1.0: - dependencies: - convert-hrtime: 5.0.0 - tinybench@6.1.4: {} tinyexec@1.3.0: {} @@ -3253,8 +3188,6 @@ snapshots: dependencies: prelude-ls: 1.2.1 - type-fest@4.41.0: {} - typedoc@0.28.20(@typescript/typescript6@6.0.2): dependencies: '@gerrit0/mini-shiki': 3.23.0 @@ -3336,9 +3269,9 @@ snapshots: '@unrs/resolver-binding-win32-ia32-msvc': 1.12.2 '@unrs/resolver-binding-win32-x64-msvc': 1.12.2 - update-browserslist-db@1.3.2(browserslist@4.28.8): + update-browserslist-db@1.3.3(browserslist@4.29.0): dependencies: - browserslist: 4.28.8 + browserslist: 4.29.0 escalade: 3.2.0 picocolors: 1.1.1 @@ -3382,8 +3315,6 @@ snapshots: transitivePeerDependencies: - msw - web-worker@1.5.0: {} - which@2.0.2: dependencies: isexe: 2.0.0 @@ -3397,6 +3328,8 @@ snapshots: yaml@2.9.0: {} + yaml@2.9.1: {} + yocto-queue@0.1.0: {} yuku-ast@0.9.3: diff --git a/src/__tests__/index.spec.ts b/src/__tests__/index.spec.ts index 498808b..3de67a7 100644 --- a/src/__tests__/index.spec.ts +++ b/src/__tests__/index.spec.ts @@ -49,7 +49,6 @@ describe('UCI', () => { ); try { - // eslint-disable-next-line unicorn/no-nonstandard-builtin-properties await uci[Symbol.asyncDispose](); } catch { // ignore diff --git a/src/index.ts b/src/index.ts index ca9d5e0..69211fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -162,31 +162,17 @@ class UCI { ): Promise { await this.ready(); - const parts: string[] = ['go']; - - if (isPondering) { - parts.push('ponder'); - } - - if (options.wtime !== undefined) { - parts.push('wtime', String(options.wtime)); - } - - if (options.btime !== undefined) { - parts.push('btime', String(options.btime)); - } - - if (options.winc !== undefined) { - parts.push('winc', String(options.winc)); - } - - if (options.binc !== undefined) { - parts.push('binc', String(options.binc)); - } - - if (options.movestogo !== undefined) { - parts.push('movestogo', String(options.movestogo)); - } + const parts: string[] = [ + 'go', + ...(isPondering ? ['ponder'] : []), + ...(options.wtime === undefined ? [] : ['wtime', String(options.wtime)]), + ...(options.btime === undefined ? [] : ['btime', String(options.btime)]), + ...(options.winc === undefined ? [] : ['winc', String(options.winc)]), + ...(options.binc === undefined ? [] : ['binc', String(options.binc)]), + ...(options.movestogo === undefined + ? [] + : ['movestogo', String(options.movestogo)]), + ]; const depth = options.depth ?? (this.#depth === 'infinite' ? undefined : this.#depth); @@ -300,7 +286,6 @@ class UCI { this.#lines = value; } - // eslint-disable-next-line unicorn/no-nonstandard-builtin-properties async [Symbol.asyncDispose](): Promise { await this.execute('quit'); this.process.kill(); @@ -348,11 +333,13 @@ class UCI { listener: (data: Events[K]) => void | Promise, ): void { const wrapped = this.#listeners.get(listener); - if (wrapped) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.#emitter.off(event, wrapped as any); - this.#listeners.delete(listener); + if (!wrapped) { + return; } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this.#emitter.off(event, wrapped as any); + this.#listeners.delete(listener); } on( diff --git a/src/parser/info.ts b/src/parser/info.ts index ff8db32..0cd76e3 100644 --- a/src/parser/info.ts +++ b/src/parser/info.ts @@ -63,11 +63,9 @@ function parseScore(raw: string): Score | undefined { return { bound: 'lower', type: 'cp', value }; } - if (hasUpperbound) { - return { bound: 'upper', type: 'cp', value }; - } - - return { type: 'cp', value }; + return hasUpperbound + ? { bound: 'upper', type: 'cp', value } + : { type: 'cp', value }; } return { type: 'mate', value }; diff --git a/src/types.ts b/src/types.ts index f674f75..2a87d0e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -35,10 +35,14 @@ interface Name { name: string; } -/** Options exposed by a UCI engine */ +/** +Options exposed by a UCI engine +*/ type Option = OneOf<[Button, Check, Combo, Spin, Stringy]> & Name; -/** Events emitted by the UCI engine wrapper */ +/** +Events emitted by the UCI engine wrapper +*/ interface Events { bestmove: { move: string | undefined; ponder?: string }; copyprotection: string; @@ -52,7 +56,9 @@ interface Events { uciok: undefined; } -/** Parameters for the UCI `go` command */ +/** +Parameters for the UCI `go` command +*/ interface GoOptions { binc?: number; btime?: number; @@ -66,20 +72,26 @@ interface GoOptions { wtime?: number; } -/** Engine identity (name + author) */ +/** +Engine identity (name + author) +*/ interface ID { author: string; name: string; } -/** Score from the engine — centipawns or mate distance, with optional bound */ +/** +Score from the engine — centipawns or mate distance, with optional bound +*/ type Score = | { bound: 'lower'; type: 'cp'; value: number } | { bound: 'upper'; type: 'cp'; value: number } | { bound?: never; type: 'cp'; value: number } | { bound?: never; type: 'mate'; value: number }; -/** Information emitted by the engine via `info` command */ +/** +Information emitted by the engine via `info` command +*/ interface InfoCommand { cpuload?: number; current?: { line?: string[]; move?: string; number?: number };