From 34b0b523e11cb6e9ebf9e39a9536eade5c6863d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:49:34 -0800 Subject: [PATCH 01/13] chore(deps): bump @typescript-eslint/eslint-plugin from 8.6.0 to 8.14.0 (#8662) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 8.6.0 to 8.14.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.14.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 129 ++++++++++++++++------------------------------ 1 file changed, 45 insertions(+), 84 deletions(-) diff --git a/package-lock.json b/package-lock.json index 626befab0..676720505 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1122,16 +1122,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.6.0.tgz", - "integrity": "sha512-UOaz/wFowmoh2G6Mr9gw60B1mm0MzUtm6Ic8G2yM1Le6gyj5Loi/N+O5mocugRGY+8OeeKmkMmbxNqUCq3B4Sg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.14.0.tgz", + "integrity": "sha512-tqp8H7UWFaZj0yNO6bycd5YjMwxa6wIHOLZvWPkidwbgLCsBMetQoGj7DPuAlWa2yGO3H48xmPwjhsSPPCGU5w==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.6.0", - "@typescript-eslint/type-utils": "8.6.0", - "@typescript-eslint/utils": "8.6.0", - "@typescript-eslint/visitor-keys": "8.6.0", + "@typescript-eslint/scope-manager": "8.14.0", + "@typescript-eslint/type-utils": "8.14.0", + "@typescript-eslint/utils": "8.14.0", + "@typescript-eslint/visitor-keys": "8.14.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1294,13 +1294,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.6.0.tgz", - "integrity": "sha512-ZuoutoS5y9UOxKvpc/GkvF4cuEmpokda4wRg64JEia27wX+PysIE9q+lzDtlHHgblwUWwo5/Qn+/WyTUvDwBHw==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.14.0.tgz", + "integrity": "sha512-aBbBrnW9ARIDn92Zbo7rguLnqQ/pOrUguVpbUwzOhkFg2npFDwTgPGqFqE0H5feXcOoJOfX3SxlJaKEVtq54dw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.6.0", - "@typescript-eslint/visitor-keys": "8.6.0" + "@typescript-eslint/types": "8.14.0", + "@typescript-eslint/visitor-keys": "8.14.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1310,27 +1310,14 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/scope-manager/node_modules/@typescript-eslint/types": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.6.0.tgz", - "integrity": "sha512-rojqFZGd4MQxw33SrOy09qIDS8WEldM8JWtKQLAjf/X5mGSeEFh5ixQlxssMNyPslVIk9yzWqXCsV2eFhYrYUw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.6.0.tgz", - "integrity": "sha512-dtePl4gsuenXVwC7dVNlb4mGDcKjDT/Ropsk4za/ouMBPplCLyznIaR+W65mvCvsyS97dymoBRrioEXI7k0XIg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.14.0.tgz", + "integrity": "sha512-Xcz9qOtZuGusVOH5Uk07NGs39wrKkf3AxlkK79RBK6aJC1l03CobXjJbwBPSidetAOV+5rEVuiT1VSBUOAsanQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "8.6.0", - "@typescript-eslint/utils": "8.6.0", + "@typescript-eslint/typescript-estree": "8.14.0", + "@typescript-eslint/utils": "8.14.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1347,14 +1334,27 @@ } } }, + "node_modules/@typescript-eslint/types": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.14.0.tgz", + "integrity": "sha512-yjeB9fnO/opvLJFAsPNYlKPnEM8+z4og09Pk504dkqonT02AyL5Z9SSqlE0XqezS93v6CXn49VHvB2G7XSsl0g==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.6.0.tgz", - "integrity": "sha512-MOVAzsKJIPIlLK239l5s06YXjNqpKTVhBVDnqUumQJja5+Y94V3+4VUFRA0G60y2jNnTVwRCkhyGQpavfsbq/g==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.14.0.tgz", + "integrity": "sha512-OPXPLYKGZi9XS/49rdaCbR5j/S14HazviBlUQFvSKz3npr3NikF+mrgK7CFVur6XEt95DZp/cmke9d5i3vtVnQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.6.0", - "@typescript-eslint/visitor-keys": "8.6.0", + "@typescript-eslint/types": "8.14.0", + "@typescript-eslint/visitor-keys": "8.14.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1375,19 +1375,6 @@ } } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/types": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.6.0.tgz", - "integrity": "sha512-rojqFZGd4MQxw33SrOy09qIDS8WEldM8JWtKQLAjf/X5mGSeEFh5ixQlxssMNyPslVIk9yzWqXCsV2eFhYrYUw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -1425,15 +1412,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.6.0.tgz", - "integrity": "sha512-eNp9cWnYf36NaOVjkEUznf6fEgVy1TWpE0o52e4wtojjBx7D1UV2WAWGzR+8Y5lVFtpMLPwNbC67T83DWSph4A==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.14.0.tgz", + "integrity": "sha512-OGqj6uB8THhrHj0Fk27DcHPojW7zKwKkPmHXHvQ58pLYp4hy8CSUdTKykKeh+5vFqTTVmjz0zCOOPKRovdsgHA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.6.0", - "@typescript-eslint/types": "8.6.0", - "@typescript-eslint/typescript-estree": "8.6.0" + "@typescript-eslint/scope-manager": "8.14.0", + "@typescript-eslint/types": "8.14.0", + "@typescript-eslint/typescript-estree": "8.14.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1446,26 +1433,13 @@ "eslint": "^8.57.0 || ^9.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.6.0.tgz", - "integrity": "sha512-rojqFZGd4MQxw33SrOy09qIDS8WEldM8JWtKQLAjf/X5mGSeEFh5ixQlxssMNyPslVIk9yzWqXCsV2eFhYrYUw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.6.0.tgz", - "integrity": "sha512-wapVFfZg9H0qOYh4grNVQiMklJGluQrOUiOhYRrQWhx7BY/+I1IYb8BczWNbbUpO+pqy0rDciv3lQH5E1bCLrg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.14.0.tgz", + "integrity": "sha512-vG0XZo8AdTH9OE6VFRwAZldNc7qtJ/6NLGWak+BtENuEUXGZgFpihILPiBvKXvJ2nFu27XNGC6rKiwuaoMbYzQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.6.0", + "@typescript-eslint/types": "8.14.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -1476,19 +1450,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/@typescript-eslint/types": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.6.0.tgz", - "integrity": "sha512-rojqFZGd4MQxw33SrOy09qIDS8WEldM8JWtKQLAjf/X5mGSeEFh5ixQlxssMNyPslVIk9yzWqXCsV2eFhYrYUw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", From b73d6156a52a78c8fbfcb10b99a7160104be2e7c Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Thu, 21 Nov 2024 11:28:27 -0800 Subject: [PATCH 02/13] fix: Fix bug that caused comments to be incorrectly positioned. (#8668) --- core/icons/comment_icon.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/icons/comment_icon.ts b/core/icons/comment_icon.ts index 8cdf77918..ea120ca17 100644 --- a/core/icons/comment_icon.ts +++ b/core/icons/comment_icon.ts @@ -338,8 +338,7 @@ export class CommentIcon extends Icon implements IHasBubble, ISerializable { * I.E. the block that owns this icon. */ private getBubbleOwnerRect(): Rect { - const bbox = (this.sourceBlock as BlockSvg).getSvgRoot().getBBox(); - return new Rect(bbox.y, bbox.y + bbox.height, bbox.x, bbox.x + bbox.width); + return (this.sourceBlock as BlockSvg).getBoundingRectangleWithoutChildren(); } } From 6f3f884345c9874fd3cd52eb2816d86902554ef6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 09:52:09 -0800 Subject: [PATCH 03/13] chore(deps): bump @typescript-eslint/parser from 8.11.0 to 8.15.0 (#8673) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 8.11.0 to 8.15.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.15.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 62 ++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index 676720505..971bc80c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1155,15 +1155,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.11.0.tgz", - "integrity": "sha512-lmt73NeHdy1Q/2ul295Qy3uninSqi6wQI18XwSpm8w0ZbQXUpjCAWP1Vlv/obudoBiIjJVjlztjQ+d/Md98Yxg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.15.0.tgz", + "integrity": "sha512-7n59qFpghG4uazrF9qtGKBZXn7Oz4sOMm8dwNWDQY96Xlm2oX67eipqcblDj+oY1lLCbf1oltMZFpUso66Kl1A==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.11.0", - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/typescript-estree": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0", + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/typescript-estree": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "debug": "^4.3.4" }, "engines": { @@ -1183,13 +1183,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.11.0.tgz", - "integrity": "sha512-Uholz7tWhXmA4r6epo+vaeV7yjdKy5QFCERMjs1kMVsLRKIrSdM6o21W2He9ftp5PP6aWOVpD5zvrvuHZC0bMQ==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.15.0.tgz", + "integrity": "sha512-QRGy8ADi4J7ii95xz4UoiymmmMd/zuy9azCaamnZ3FM8T5fZcex8UfJcjkiEZjJSztKfEBe3dZ5T/5RHAmw2mA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0" + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1200,9 +1200,9 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.11.0.tgz", - "integrity": "sha512-tn6sNMHf6EBAYMvmPUaKaVeYvhUsrE6x+bXQTxjQRp360h1giATU0WvgeEys1spbvb5R+VpNOZ+XJmjD8wOUHw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.15.0.tgz", + "integrity": "sha512-n3Gt8Y/KyJNe0S3yDCD2RVKrHBC4gTUcLTebVBXacPy091E6tNspFLKRXlk3hwT4G55nfr1n2AdFqi/XMxzmPQ==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1213,13 +1213,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.11.0.tgz", - "integrity": "sha512-yHC3s1z1RCHoCz5t06gf7jH24rr3vns08XXhfEqzYpd6Hll3z/3g23JRi0jM8A47UFKNc3u/y5KIMx8Ynbjohg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.15.0.tgz", + "integrity": "sha512-1eMp2JgNec/niZsR7ioFBlsh/Fk0oJbhaqO0jRyQBMgkz7RrFfkqF9lYYmBoGBaSiLnu8TAPQTwoTUiSTUW9dg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.11.0", - "@typescript-eslint/visitor-keys": "8.11.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1241,13 +1241,13 @@ } }, "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.11.0.tgz", - "integrity": "sha512-EaewX6lxSjRJnc+99+dqzTeoDZUfyrA52d2/HRrkI830kgovWsmIiTfmr0NZorzqic7ga+1bS60lRBUgR3n/Bw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.15.0.tgz", + "integrity": "sha512-h8vYOulWec9LhpwfAdZf2bjr8xIp0KNKnpgqSz0qqYYKAW/QZKw3ktRndbiAtUz4acH4QLQavwZBYCc0wulA/Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.11.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.15.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1266,6 +1266,18 @@ "balanced-match": "^1.0.0" } }, + "node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@typescript-eslint/parser/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", From 61bbd7dbf6de1306986389a72f7a14fd7641b9ba Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Mon, 2 Dec 2024 11:33:05 -0800 Subject: [PATCH 04/13] chore: Remove underscores from private fields. (#8682) * chore: Remove underscores from private fields. * refactor: Use public APIs in tests where possible. --- core/block.ts | 126 +++++++++--------- core/block_svg.ts | 40 ++---- core/component_manager.ts | 6 +- core/contextmenu_registry.ts | 16 +-- core/events/events_block_move.ts | 6 +- core/field.ts | 36 ++--- core/field_checkbox.ts | 6 +- core/field_input.ts | 32 ++--- core/flyout_base.ts | 8 +- core/flyout_metrics_manager.ts | 4 +- core/gesture.ts | 6 +- core/marker_manager.ts | 40 +++--- core/options.ts | 16 +-- core/scrollbar_pair.ts | 44 +++--- core/shortcut_registry.ts | 8 +- core/theme_manager.ts | 12 +- core/toolbox/category.ts | 12 +- core/toolbox/collapsible_category.ts | 4 +- core/toolbox/separator.ts | 8 +- core/toolbox/toolbox.ts | 58 ++++---- core/variable_map.ts | 15 +-- core/variable_model.ts | 6 +- core/workspace.ts | 8 +- core/workspace_audio.ts | 8 +- core/workspace_dragger.ts | 14 +- core/workspace_svg.ts | 64 ++++----- tests/mocha/block_json_test.js | 34 ++--- tests/mocha/block_test.js | 8 +- tests/mocha/blocks/logic_ternary_test.js | 2 +- tests/mocha/blocks/procedures_test.js | 16 +-- tests/mocha/event_test.js | 8 +- tests/mocha/field_number_test.js | 2 +- tests/mocha/field_test.js | 10 +- tests/mocha/field_textinput_test.js | 2 +- tests/mocha/keydown_test.js | 2 +- tests/mocha/shortcut_registry_test.js | 8 +- .../mocha/test_helpers/toolbox_definitions.js | 2 +- tests/mocha/toolbox_test.js | 72 +++++----- tests/mocha/variable_model_test.js | 8 +- tests/mocha/workspace_svg_test.js | 2 +- 40 files changed, 378 insertions(+), 401 deletions(-) diff --git a/core/block.ts b/core/block.ts index 189f67781..0face8f8c 100644 --- a/core/block.ts +++ b/core/block.ts @@ -89,7 +89,7 @@ export class Block implements IASTNodeLocation { * Colour of the block as HSV hue value (0-360) * This may be null if the block colour was not set via a hue number. */ - private hue_: number | null = null; + private hue: number | null = null; /** Colour of the block in '#RRGGBB' format. */ protected colour_ = '#000000'; @@ -184,13 +184,13 @@ export class Block implements IASTNodeLocation { protected childBlocks_: this[] = []; - private deletable_ = true; + private deletable = true; - private movable_ = true; + private movable = true; - private editable_ = true; + private editable = true; - private isShadow_ = false; + private shadow = false; protected collapsed_ = false; protected outputShape_: number | null = null; @@ -207,7 +207,7 @@ export class Block implements IASTNodeLocation { */ initialized = false; - private readonly xy_: Coordinate; + private readonly xy: Coordinate; isInFlyout: boolean; isInMutator: boolean; RTL: boolean; @@ -227,7 +227,7 @@ export class Block implements IASTNodeLocation { helpUrl: string | (() => string) | null = null; /** A bound callback function to use when the parent workspace changes. */ - private onchangeWrapper_: ((p1: Abstract) => void) | null = null; + private onchangeWrapper: ((p1: Abstract) => void) | null = null; /** * A count of statement inputs on the block. @@ -260,7 +260,7 @@ export class Block implements IASTNodeLocation { * The block's position in workspace units. (0, 0) is at the workspace's * origin; scale does not change this value. */ - this.xy_ = new Coordinate(0, 0); + this.xy = new Coordinate(0, 0); this.isInFlyout = workspace.isFlyout; this.isInMutator = workspace.isMutator; @@ -333,8 +333,8 @@ export class Block implements IASTNodeLocation { // Dispose of this change listener before unplugging. // Technically not necessary due to the event firing delay. // But future-proofing. - if (this.onchangeWrapper_) { - this.workspace.removeChangeListener(this.onchangeWrapper_); + if (this.onchangeWrapper) { + this.workspace.removeChangeListener(this.onchangeWrapper); } this.unplug(healStack); @@ -352,8 +352,8 @@ export class Block implements IASTNodeLocation { */ protected disposeInternal() { this.disposing = true; - if (this.onchangeWrapper_) { - this.workspace.removeChangeListener(this.onchangeWrapper_); + if (this.onchangeWrapper) { + this.workspace.removeChangeListener(this.onchangeWrapper); } this.workspace.removeTypedBlock(this); @@ -403,10 +403,10 @@ export class Block implements IASTNodeLocation { */ unplug(opt_healStack?: boolean) { if (this.outputConnection) { - this.unplugFromRow_(opt_healStack); + this.unplugFromRow(opt_healStack); } if (this.previousConnection) { - this.unplugFromStack_(opt_healStack); + this.unplugFromStack(opt_healStack); } } @@ -417,7 +417,7 @@ export class Block implements IASTNodeLocation { * @param opt_healStack Disconnect right-side block and connect to left-side * block. Defaults to false. */ - private unplugFromRow_(opt_healStack?: boolean) { + private unplugFromRow(opt_healStack?: boolean) { let parentConnection = null; if (this.outputConnection?.isConnected()) { parentConnection = this.outputConnection.targetConnection; @@ -430,7 +430,7 @@ export class Block implements IASTNodeLocation { return; } - const thisConnection = this.getOnlyValueConnection_(); + const thisConnection = this.getOnlyValueConnection(); if ( !thisConnection || !thisConnection.isConnected() || @@ -467,7 +467,7 @@ export class Block implements IASTNodeLocation { * * @returns The connection on the value input, or null. */ - private getOnlyValueConnection_(): Connection | null { + private getOnlyValueConnection(): Connection | null { let connection = null; for (let i = 0; i < this.inputList.length; i++) { const thisConnection = this.inputList[i].connection; @@ -492,7 +492,7 @@ export class Block implements IASTNodeLocation { * @param opt_healStack Disconnect child statement and reconnect stack. * Defaults to false. */ - private unplugFromStack_(opt_healStack?: boolean) { + private unplugFromStack(opt_healStack?: boolean) { let previousTarget = null; if (this.previousConnection?.isConnected()) { // Remember the connection that any next statements need to connect to. @@ -789,8 +789,8 @@ export class Block implements IASTNodeLocation { */ isDeletable(): boolean { return ( - this.deletable_ && - !this.isShadow_ && + this.deletable && + !this.shadow && !this.isDeadOrDying() && !this.workspace.options.readOnly ); @@ -802,7 +802,7 @@ export class Block implements IASTNodeLocation { * @returns True if the block's deletable property is true, false otherwise. */ isOwnDeletable(): boolean { - return this.deletable_; + return this.deletable; } /** @@ -811,7 +811,7 @@ export class Block implements IASTNodeLocation { * @param deletable True if deletable. */ setDeletable(deletable: boolean) { - this.deletable_ = deletable; + this.deletable = deletable; } /** @@ -822,8 +822,8 @@ export class Block implements IASTNodeLocation { */ isMovable(): boolean { return ( - this.movable_ && - !this.isShadow_ && + this.movable && + !this.shadow && !this.isDeadOrDying() && !this.workspace.options.readOnly ); @@ -836,7 +836,7 @@ export class Block implements IASTNodeLocation { * @internal */ isOwnMovable(): boolean { - return this.movable_; + return this.movable; } /** @@ -845,7 +845,7 @@ export class Block implements IASTNodeLocation { * @param movable True if movable. */ setMovable(movable: boolean) { - this.movable_ = movable; + this.movable = movable; } /** @@ -871,7 +871,7 @@ export class Block implements IASTNodeLocation { * @returns True if a shadow. */ isShadow(): boolean { - return this.isShadow_; + return this.shadow; } /** @@ -883,7 +883,7 @@ export class Block implements IASTNodeLocation { * @internal */ setShadow(shadow: boolean) { - this.isShadow_ = shadow; + this.shadow = shadow; } /** @@ -914,9 +914,7 @@ export class Block implements IASTNodeLocation { */ isEditable(): boolean { return ( - this.editable_ && - !this.isDeadOrDying() && - !this.workspace.options.readOnly + this.editable && !this.isDeadOrDying() && !this.workspace.options.readOnly ); } @@ -926,7 +924,7 @@ export class Block implements IASTNodeLocation { * @returns True if the block's editable property is true, false otherwise. */ isOwnEditable(): boolean { - return this.editable_; + return this.editable; } /** @@ -935,7 +933,7 @@ export class Block implements IASTNodeLocation { * @param editable True if editable. */ setEditable(editable: boolean) { - this.editable_ = editable; + this.editable = editable; for (let i = 0, input; (input = this.inputList[i]); i++) { for (let j = 0, field; (field = input.fieldRow[j]); j++) { field.updateEditable(); @@ -1046,7 +1044,7 @@ export class Block implements IASTNodeLocation { * @returns Hue value (0-360). */ getHue(): number | null { - return this.hue_; + return this.hue; } /** @@ -1057,7 +1055,7 @@ export class Block implements IASTNodeLocation { */ setColour(colour: number | string) { const parsed = parsing.parseBlockColour(colour); - this.hue_ = parsed.hue; + this.hue = parsed.hue; this.colour_ = parsed.hex; } @@ -1083,12 +1081,12 @@ export class Block implements IASTNodeLocation { if (onchangeFn && typeof onchangeFn !== 'function') { throw Error('onchange must be a function.'); } - if (this.onchangeWrapper_) { - this.workspace.removeChangeListener(this.onchangeWrapper_); + if (this.onchangeWrapper) { + this.workspace.removeChangeListener(this.onchangeWrapper); } this.onchange = onchangeFn; - this.onchangeWrapper_ = onchangeFn.bind(this); - this.workspace.addChangeListener(this.onchangeWrapper_); + this.onchangeWrapper = onchangeFn.bind(this); + this.workspace.addChangeListener(this.onchangeWrapper); } /** @@ -1774,15 +1772,15 @@ export class Block implements IASTNodeLocation { if (json['style'] && json['colour']) { throw Error(warningPrefix + 'Must not have both a colour and a style.'); } else if (json['style']) { - this.jsonInitStyle_(json, warningPrefix); + this.jsonInitStyle(json, warningPrefix); } else { - this.jsonInitColour_(json, warningPrefix); + this.jsonInitColour(json, warningPrefix); } // Interpolate the message blocks. let i = 0; while (json['message' + i] !== undefined) { - this.interpolate_( + this.interpolate( json['message' + i], json['args' + i] || [], // Backwards compatibility: lastDummyAlign aliases implicitAlign. @@ -1857,7 +1855,7 @@ export class Block implements IASTNodeLocation { * @param json Structured data describing the block. * @param warningPrefix Warning prefix string identifying block. */ - private jsonInitColour_(json: AnyDuringMigration, warningPrefix: string) { + private jsonInitColour(json: AnyDuringMigration, warningPrefix: string) { if ('colour' in json) { if (json['colour'] === undefined) { console.warn(warningPrefix + 'Undefined colour value.'); @@ -1878,7 +1876,7 @@ export class Block implements IASTNodeLocation { * @param json Structured data describing the block. * @param warningPrefix Warning prefix string identifying block. */ - private jsonInitStyle_(json: AnyDuringMigration, warningPrefix: string) { + private jsonInitStyle(json: AnyDuringMigration, warningPrefix: string) { const blockStyleName = json['style']; try { this.setStyle(blockStyleName); @@ -1930,21 +1928,21 @@ export class Block implements IASTNodeLocation { * of newline tokens, how should it be aligned? * @param warningPrefix Warning prefix string identifying block. */ - private interpolate_( + private interpolate( message: string, args: AnyDuringMigration[], implicitAlign: string | undefined, warningPrefix: string, ) { const tokens = parsing.tokenizeInterpolation(message); - this.validateTokens_(tokens, args.length); - const elements = this.interpolateArguments_(tokens, args, implicitAlign); + this.validateTokens(tokens, args.length); + const elements = this.interpolateArguments(tokens, args, implicitAlign); // An array of [field, fieldName] tuples. const fieldStack = []; for (let i = 0, element; (element = elements[i]); i++) { - if (this.isInputKeyword_(element['type'])) { - const input = this.inputFromJson_(element, warningPrefix); + if (this.isInputKeyword(element['type'])) { + const input = this.inputFromJson(element, warningPrefix); // Should never be null, but just in case. if (input) { for (let j = 0, tuple; (tuple = fieldStack[j]); j++) { @@ -1955,7 +1953,7 @@ export class Block implements IASTNodeLocation { } else { // All other types, including ones starting with 'input_' get routed // here. - const field = this.fieldFromJson_(element); + const field = this.fieldFromJson(element); if (field) { fieldStack.push([field, element['name']]); } @@ -1971,7 +1969,7 @@ export class Block implements IASTNodeLocation { * @param tokens An array of tokens to validate * @param argsCount The number of args that need to be referred to. */ - private validateTokens_(tokens: Array, argsCount: number) { + private validateTokens(tokens: Array, argsCount: number) { const visitedArgsHash = []; let visitedArgsCount = 0; for (let i = 0; i < tokens.length; i++) { @@ -2026,7 +2024,7 @@ export class Block implements IASTNodeLocation { * or dummy inputs, if necessary. * @returns The JSON definitions of field and inputs to add to the block. */ - private interpolateArguments_( + private interpolateArguments( tokens: Array, args: Array, implicitAlign: string | undefined, @@ -2049,7 +2047,7 @@ export class Block implements IASTNodeLocation { } else { // AnyDuringMigration because: Type '{ text: string; type: string; } // | null' is not assignable to type 'string | number'. - element = this.stringToFieldJson_(element) as AnyDuringMigration; + element = this.stringToFieldJson(element) as AnyDuringMigration; if (!element) { continue; } @@ -2061,9 +2059,7 @@ export class Block implements IASTNodeLocation { const length = elements.length; if ( length && - !this.isInputKeyword_( - (elements as AnyDuringMigration)[length - 1]['type'], - ) + !this.isInputKeyword((elements as AnyDuringMigration)[length - 1]['type']) ) { const dummyInput = {'type': 'input_dummy'}; if (implicitAlign) { @@ -2083,7 +2079,7 @@ export class Block implements IASTNodeLocation { * @param element The element to try to turn into a field. * @returns The field defined by the JSON, or null if one couldn't be created. */ - private fieldFromJson_(element: { + private fieldFromJson(element: { alt?: string; type: string; text?: string; @@ -2091,10 +2087,10 @@ export class Block implements IASTNodeLocation { const field = fieldRegistry.fromJson(element); if (!field && element['alt']) { if (typeof element['alt'] === 'string') { - const json = this.stringToFieldJson_(element['alt']); - return json ? this.fieldFromJson_(json) : null; + const json = this.stringToFieldJson(element['alt']); + return json ? this.fieldFromJson(json) : null; } - return this.fieldFromJson_(element['alt']); + return this.fieldFromJson(element['alt']); } return field; } @@ -2109,7 +2105,7 @@ export class Block implements IASTNodeLocation { * @returns The input that has been created, or null if one could not be * created for some reason (should never happen). */ - private inputFromJson_( + private inputFromJson( element: AnyDuringMigration, warningPrefix: string, ): Input | null { @@ -2167,7 +2163,7 @@ export class Block implements IASTNodeLocation { * @returns True if the given string matches one of the input keywords, false * otherwise. */ - private isInputKeyword_(str: string): boolean { + private isInputKeyword(str: string): boolean { return ( str === 'input_value' || str === 'input_statement' || @@ -2184,7 +2180,7 @@ export class Block implements IASTNodeLocation { * @param str String to turn into the JSON definition of a label field. * @returns The JSON definition or null. */ - private stringToFieldJson_(str: string): {text: string; type: string} | null { + private stringToFieldJson(str: string): {text: string; type: string} | null { str = str.trim(); if (str) { return { @@ -2445,7 +2441,7 @@ export class Block implements IASTNodeLocation { * @returns Object with .x and .y properties. */ getRelativeToSurfaceXY(): Coordinate { - return this.xy_; + return this.xy; } /** @@ -2461,7 +2457,7 @@ export class Block implements IASTNodeLocation { } const event = new (eventUtils.get(EventType.BLOCK_MOVE))(this) as BlockMove; if (reason) event.setReason(reason); - this.xy_.translate(dx, dy); + this.xy.translate(dx, dy); event.recordNew(); eventUtils.fire(event); } diff --git a/core/block_svg.ts b/core/block_svg.ts index 605d25fd4..1c1de49ec 100644 --- a/core/block_svg.ts +++ b/core/block_svg.ts @@ -145,7 +145,7 @@ export class BlockSvg /** Block's mutator icon (if any). */ mutator: MutatorIcon | null = null; - private svgGroup_: SVGGElement; + private svgGroup: SVGGElement; style: BlockStyle; /** @internal */ pathObject: IPathObject; @@ -155,15 +155,6 @@ export class BlockSvg private visuallyDisabled = false; - /** - * Is this block currently rendering? Used to stop recursive render calls - * from actually triggering a re-render. - */ - private renderIsInProgress_ = false; - - /** Whether mousedown events have been bound yet. */ - private eventsInit_ = false; - override workspace: WorkspaceSvg; // TODO(b/109816955): remove '!', see go/strict-prop-init-fix. override outputConnection!: RenderedConnection; @@ -201,7 +192,7 @@ export class BlockSvg throw TypeError('Cannot create a rendered block in a headless workspace'); } this.workspace = workspace; - this.svgGroup_ = dom.createSvgElement(Svg.G, {}); + this.svgGroup = dom.createSvgElement(Svg.G, {}); /** A block style object. */ this.style = workspace.getRenderer().getConstants().getBlockStyle(null); @@ -209,14 +200,14 @@ export class BlockSvg /** The renderer's path object. */ this.pathObject = workspace .getRenderer() - .makePathObject(this.svgGroup_, this.style); + .makePathObject(this.svgGroup, this.style); const svgPath = this.pathObject.svgPath; (svgPath as any).tooltip = this; Tooltip.bindMouseEvents(svgPath); // Expose this block's ID on its top-level SVG group. - this.svgGroup_.setAttribute('data-id', this.id); + this.svgGroup.setAttribute('data-id', this.id); this.doInit_(); } @@ -238,12 +229,7 @@ export class BlockSvg this.pathObject.updateMovable(this.isMovable() || this.isInFlyout); const svg = this.getSvgRoot(); if (!this.workspace.options.readOnly && svg) { - browserEvents.conditionalBind( - svg, - 'pointerdown', - this, - this.onMouseDown_, - ); + browserEvents.conditionalBind(svg, 'pointerdown', this, this.onMouseDown); } if (!svg.parentNode) { @@ -518,14 +504,14 @@ export class BlockSvg return; } super.setCollapsed(collapsed); - this.updateCollapsed_(); + this.updateCollapsed(); } /** * Makes sure that when the block is collapsed, it is rendered correctly * for that state. */ - private updateCollapsed_() { + private updateCollapsed() { const collapsed = this.isCollapsed(); const collapsedInputName = constants.COLLAPSED_INPUT_NAME; const collapsedFieldName = constants.COLLAPSED_FIELD_NAME; @@ -592,7 +578,7 @@ export class BlockSvg * * @param e Pointer down event. */ - private onMouseDown_(e: PointerEvent) { + private onMouseDown(e: PointerEvent) { const gesture = this.workspace.getGesture(e); if (gesture) { gesture.handleBlockStart(e, this); @@ -702,10 +688,10 @@ export class BlockSvg if (adding) { this.translation = ''; common.draggingConnections.push(...this.getConnections_(true)); - dom.addClass(this.svgGroup_, 'blocklyDragging'); + dom.addClass(this.svgGroup, 'blocklyDragging'); } else { common.draggingConnections.length = 0; - dom.removeClass(this.svgGroup_, 'blocklyDragging'); + dom.removeClass(this.svgGroup, 'blocklyDragging'); } // Recurse through all blocks attached under this one. for (let i = 0; i < this.childBlocks_.length; i++) { @@ -775,7 +761,7 @@ export class BlockSvg * @returns The root SVG node (probably a group). */ getSvgRoot(): SVGGElement { - return this.svgGroup_; + return this.svgGroup; } /** @@ -817,7 +803,7 @@ export class BlockSvg } super.dispose(!!healStack); - dom.removeNode(this.svgGroup_); + dom.removeNode(this.svgGroup); } /** @@ -1565,7 +1551,7 @@ export class BlockSvg dom.startTextWidthCache(); if (this.isCollapsed()) { - this.updateCollapsed_(); + this.updateCollapsed(); } if (!this.isEnabled()) { diff --git a/core/component_manager.ts b/core/component_manager.ts index fb89c38ae..8363d6fb4 100644 --- a/core/component_manager.ts +++ b/core/component_manager.ts @@ -23,10 +23,10 @@ class Capability<_T> { static DRAG_TARGET = new Capability('drag_target'); static DELETE_AREA = new Capability('delete_area'); static AUTOHIDEABLE = new Capability('autohideable'); - private readonly name_: string; + private readonly name: string; /** @param name The name of the component capability. */ constructor(name: string) { - this.name_ = name; + this.name = name; } /** @@ -35,7 +35,7 @@ class Capability<_T> { * @returns The name. */ toString(): string { - return this.name_; + return this.name; } } diff --git a/core/contextmenu_registry.ts b/core/contextmenu_registry.ts index abbd0f975..fb0d899d1 100644 --- a/core/contextmenu_registry.ts +++ b/core/contextmenu_registry.ts @@ -23,7 +23,7 @@ import type {WorkspaceSvg} from './workspace_svg.js'; export class ContextMenuRegistry { static registry: ContextMenuRegistry; /** Registry of all registered RegistryItems, keyed by ID. */ - private registry_ = new Map(); + private registeredItems = new Map(); /** Resets the existing singleton instance of ContextMenuRegistry. */ constructor() { @@ -32,7 +32,7 @@ export class ContextMenuRegistry { /** Clear and recreate the registry. */ reset() { - this.registry_.clear(); + this.registeredItems.clear(); } /** @@ -42,10 +42,10 @@ export class ContextMenuRegistry { * @throws {Error} if an item with the given ID already exists. */ register(item: RegistryItem) { - if (this.registry_.has(item.id)) { + if (this.registeredItems.has(item.id)) { throw Error('Menu item with ID "' + item.id + '" is already registered.'); } - this.registry_.set(item.id, item); + this.registeredItems.set(item.id, item); } /** @@ -55,10 +55,10 @@ export class ContextMenuRegistry { * @throws {Error} if an item with the given ID does not exist. */ unregister(id: string) { - if (!this.registry_.has(id)) { + if (!this.registeredItems.has(id)) { throw new Error('Menu item with ID "' + id + '" not found.'); } - this.registry_.delete(id); + this.registeredItems.delete(id); } /** @@ -66,7 +66,7 @@ export class ContextMenuRegistry { * @returns RegistryItem or null if not found */ getItem(id: string): RegistryItem | null { - return this.registry_.get(id) ?? null; + return this.registeredItems.get(id) ?? null; } /** @@ -85,7 +85,7 @@ export class ContextMenuRegistry { scope: Scope, ): ContextMenuOption[] { const menuOptions: ContextMenuOption[] = []; - for (const item of this.registry_.values()) { + for (const item of this.registeredItems.values()) { if (scopeType === item.scopeType) { const precondition = item.preconditionFn(scope); if (precondition !== 'hidden') { diff --git a/core/events/events_block_move.ts b/core/events/events_block_move.ts index cd683a777..99e162289 100644 --- a/core/events/events_block_move.ts +++ b/core/events/events_block_move.ts @@ -89,7 +89,7 @@ export class BlockMove extends BlockBase { this.recordUndo = false; } - const location = this.currentLocation_(); + const location = this.currentLocation(); this.oldParentId = location.parentId; this.oldInputName = location.inputName; this.oldCoordinate = location.coordinate; @@ -167,7 +167,7 @@ export class BlockMove extends BlockBase { /** Record the block's new location. Called after the move. */ recordNew() { - const location = this.currentLocation_(); + const location = this.currentLocation(); this.newParentId = location.parentId; this.newInputName = location.inputName; this.newCoordinate = location.coordinate; @@ -188,7 +188,7 @@ export class BlockMove extends BlockBase { * * @returns Collection of location info. */ - private currentLocation_(): BlockLocation { + private currentLocation(): BlockLocation { const workspace = this.getEventWorkspace_(); if (!this.blockId) { throw new Error( diff --git a/core/field.ts b/core/field.ts index c702abadc..4c4b90cf5 100644 --- a/core/field.ts +++ b/core/field.ts @@ -107,20 +107,20 @@ export abstract class Field * Used to cache the field's tooltip value if setTooltip is called when the * field is not yet initialized. Is *not* guaranteed to be accurate. */ - private tooltip_: Tooltip.TipInfo | null = null; + private tooltip: Tooltip.TipInfo | null = null; protected size_: Size; /** * Holds the cursors svg element when the cursor is attached to the field. * This is null if there is no cursor on the field. */ - private cursorSvg_: SVGElement | null = null; + private cursorSvg: SVGElement | null = null; /** * Holds the markers svg element when the marker is attached to the field. * This is null if there is no marker on the field. */ - private markerSvg_: SVGElement | null = null; + private markerSvg: SVGElement | null = null; /** The rendered field's SVG group element. */ protected fieldGroup_: SVGGElement | null = null; @@ -135,7 +135,7 @@ export abstract class Field protected textContent_: Text | null = null; /** Mouse down event listener data. */ - private mouseDownWrapper_: browserEvents.Data | null = null; + private mouseDownWrapper: browserEvents.Data | null = null; /** Constants associated with the source block's renderer. */ protected constants_: ConstantProvider | null = null; @@ -312,7 +312,7 @@ export abstract class Field sourceBlockSvg.getSvgRoot().appendChild(this.fieldGroup_); this.initView(); this.updateEditable(); - this.setTooltip(this.tooltip_); + this.setTooltip(this.tooltip); this.bindEvents_(); this.initModel(); this.applyColour(); @@ -393,7 +393,7 @@ export abstract class Field const clickTarget = this.getClickTarget_(); if (!clickTarget) throw new Error('A click target has not been set.'); Tooltip.bindMouseEvents(clickTarget); - this.mouseDownWrapper_ = browserEvents.conditionalBind( + this.mouseDownWrapper = browserEvents.conditionalBind( clickTarget, 'pointerdown', this, @@ -1095,7 +1095,7 @@ export abstract class Field try { const classValidation = this.doClassValidation_(newValue); - const classValue = this.processValidation_( + const classValue = this.processValidation( newValue, classValidation, fireChangeEvent, @@ -1106,7 +1106,7 @@ export abstract class Field } const localValidation = this.getValidator()?.call(this, classValue); - const localValue = this.processValidation_( + const localValue = this.processValidation( classValue, localValidation, fireChangeEvent, @@ -1158,7 +1158,7 @@ export abstract class Field * @param fireChangeEvent Whether to fire a change event if the value changes. * @returns New value, or an Error object. */ - private processValidation_( + private processValidation( newValue: AnyDuringMigration, validatedValue: T | null | undefined, fireChangeEvent: boolean, @@ -1272,7 +1272,7 @@ export abstract class Field (clickTarget as AnyDuringMigration).tooltip = newTip; } else { // Field has not been initialized yet. - this.tooltip_ = newTip; + this.tooltip = newTip; } } @@ -1286,8 +1286,8 @@ export abstract class Field if (clickTarget) { return Tooltip.getTooltipOfObject(clickTarget); } - // Field has not been initialized yet. Return stashed this.tooltip_ value. - return Tooltip.getTooltipOfObject({tooltip: this.tooltip_}); + // Field has not been initialized yet. Return stashed this.tooltip value. + return Tooltip.getTooltipOfObject({tooltip: this.tooltip}); } /** @@ -1396,7 +1396,7 @@ export abstract class Field */ setCursorSvg(cursorSvg: SVGElement) { if (!cursorSvg) { - this.cursorSvg_ = null; + this.cursorSvg = null; return; } @@ -1404,7 +1404,7 @@ export abstract class Field throw new Error(`The field group is ${this.fieldGroup_}.`); } this.fieldGroup_.appendChild(cursorSvg); - this.cursorSvg_ = cursorSvg; + this.cursorSvg = cursorSvg; } /** @@ -1415,7 +1415,7 @@ export abstract class Field */ setMarkerSvg(markerSvg: SVGElement) { if (!markerSvg) { - this.markerSvg_ = null; + this.markerSvg = null; return; } @@ -1423,7 +1423,7 @@ export abstract class Field throw new Error(`The field group is ${this.fieldGroup_}.`); } this.fieldGroup_.appendChild(markerSvg); - this.markerSvg_ = markerSvg; + this.markerSvg = markerSvg; } /** @@ -1437,10 +1437,10 @@ export abstract class Field throw new UnattachedFieldError(); } const workspace = block.workspace as WorkspaceSvg; - if (workspace.keyboardAccessibilityMode && this.cursorSvg_) { + if (workspace.keyboardAccessibilityMode && this.cursorSvg) { workspace.getCursor()!.draw(); } - if (workspace.keyboardAccessibilityMode && this.markerSvg_) { + if (workspace.keyboardAccessibilityMode && this.markerSvg) { // TODO(#4592): Update all markers on the field. workspace.getMarker(MarkerManager.LOCAL_MARKER)!.draw(); } diff --git a/core/field_checkbox.ts b/core/field_checkbox.ts index 01d1851aa..5ae3dfda1 100644 --- a/core/field_checkbox.ts +++ b/core/field_checkbox.ts @@ -170,7 +170,7 @@ export class FieldCheckbox extends Field { * that this is a either 'TRUE' or 'FALSE'. */ protected override doValueUpdate_(newValue: BoolString) { - this.value_ = this.convertValueToBool_(newValue); + this.value_ = this.convertValueToBool(newValue); // Update visual. if (this.textElement_) { this.textElement_.style.display = this.value_ ? 'block' : 'none'; @@ -201,7 +201,7 @@ export class FieldCheckbox extends Field { * @returns Text representing the value of this field ('true' or 'false'). */ override getText(): string { - return String(this.convertValueToBool_(this.value_)); + return String(this.convertValueToBool(this.value_)); } /** @@ -213,7 +213,7 @@ export class FieldCheckbox extends Field { * @param value The value to convert. * @returns The converted value. */ - private convertValueToBool_(value: CheckboxBool | null): boolean { + private convertValueToBool(value: CheckboxBool | null): boolean { if (typeof value === 'string') return value === 'TRUE'; return !!value; } diff --git a/core/field_input.ts b/core/field_input.ts index 722316f4f..eecb4ec94 100644 --- a/core/field_input.ts +++ b/core/field_input.ts @@ -80,10 +80,10 @@ export abstract class FieldInput extends Field< protected valueWhenEditorWasOpened_: string | T | null = null; /** Key down event data. */ - private onKeyDownWrapper_: browserEvents.Data | null = null; + private onKeyDownWrapper: browserEvents.Data | null = null; /** Key input event data. */ - private onKeyInputWrapper_: browserEvents.Data | null = null; + private onKeyInputWrapper: browserEvents.Data | null = null; /** * Whether the field should consider the whole parent block to be its click @@ -338,9 +338,9 @@ export abstract class FieldInput extends Field< this.workspace_.options.modalInputs && (userAgent.MOBILE || userAgent.ANDROID || userAgent.IPAD) ) { - this.showPromptEditor_(); + this.showPromptEditor(); } else { - this.showInlineEditor_(quietInput); + this.showInlineEditor(quietInput); } } @@ -349,7 +349,7 @@ export abstract class FieldInput extends Field< * Mobile browsers may have issues with in-line textareas (focus and * keyboards). */ - private showPromptEditor_() { + private showPromptEditor() { dialog.prompt( Msg['CHANGE_VALUE_TITLE'], this.getText(), @@ -368,7 +368,7 @@ export abstract class FieldInput extends Field< * * @param quietInput True if editor should be created without focus. */ - private showInlineEditor_(quietInput: boolean) { + private showInlineEditor(quietInput: boolean) { const block = this.getSourceBlock(); if (!block) { throw new UnattachedFieldError(); @@ -518,30 +518,30 @@ export abstract class FieldInput extends Field< */ protected bindInputEvents_(htmlInput: HTMLElement) { // Trap Enter without IME and Esc to hide. - this.onKeyDownWrapper_ = browserEvents.conditionalBind( + this.onKeyDownWrapper = browserEvents.conditionalBind( htmlInput, 'keydown', this, this.onHtmlInputKeyDown_, ); // Resize after every input change. - this.onKeyInputWrapper_ = browserEvents.conditionalBind( + this.onKeyInputWrapper = browserEvents.conditionalBind( htmlInput, 'input', this, - this.onHtmlInputChange_, + this.onHtmlInputChange, ); } /** Unbind handlers for user input and workspace size changes. */ protected unbindInputEvents_() { - if (this.onKeyDownWrapper_) { - browserEvents.unbind(this.onKeyDownWrapper_); - this.onKeyDownWrapper_ = null; + if (this.onKeyDownWrapper) { + browserEvents.unbind(this.onKeyDownWrapper); + this.onKeyDownWrapper = null; } - if (this.onKeyInputWrapper_) { - browserEvents.unbind(this.onKeyInputWrapper_); - this.onKeyInputWrapper_ = null; + if (this.onKeyInputWrapper) { + browserEvents.unbind(this.onKeyInputWrapper); + this.onKeyInputWrapper = null; } } @@ -574,7 +574,7 @@ export abstract class FieldInput extends Field< * * @param _e Keyboard event. */ - private onHtmlInputChange_(_e: Event) { + private onHtmlInputChange(_e: Event) { // Intermediate value changes from user input are not confirmed until the // user closes the editor, and may be numerous. Inhibit reporting these as // normal block change events, and instead report them as special diff --git a/core/flyout_base.ts b/core/flyout_base.ts index ccfb91ed0..96d2b27fd 100644 --- a/core/flyout_base.ts +++ b/core/flyout_base.ts @@ -207,7 +207,7 @@ export abstract class Flyout /** * Whether the flyout is visible. */ - private isVisible_ = false; + private visible = false; /** * Whether the workspace containing this flyout is visible. @@ -286,7 +286,7 @@ export abstract class Flyout this.workspace_.internalIsFlyout = true; // Keep the workspace visibility consistent with the flyout's visibility. - this.workspace_.setVisible(this.isVisible_); + this.workspace_.setVisible(this.visible); /** * The unique id for this component that is used to register with the @@ -532,7 +532,7 @@ export abstract class Flyout * @returns True if visible. */ isVisible(): boolean { - return this.isVisible_; + return this.visible; } /** @@ -545,7 +545,7 @@ export abstract class Flyout setVisible(visible: boolean) { const visibilityChanged = visible !== this.isVisible(); - this.isVisible_ = visible; + this.visible = visible; if (visibilityChanged) { if (!this.autoClose) { // Auto-close flyouts are ignored as drag targets, so only non diff --git a/core/flyout_metrics_manager.ts b/core/flyout_metrics_manager.ts index a291f4c3b..00f675caa 100644 --- a/core/flyout_metrics_manager.ts +++ b/core/flyout_metrics_manager.ts @@ -38,7 +38,7 @@ export class FlyoutMetricsManager extends MetricsManager { * * @returns The bounding box of the blocks on the workspace. */ - private getBoundingBox_(): + private getBoundingBox(): | SVGRect | {height: number; y: number; width: number; x: number} { let blockBoundingBox; @@ -55,7 +55,7 @@ export class FlyoutMetricsManager extends MetricsManager { override getContentMetrics(opt_getWorkspaceCoordinates?: boolean) { // The bounding box is in workspace coordinates. - const blockBoundingBox = this.getBoundingBox_(); + const blockBoundingBox = this.getBoundingBox(); const scale = opt_getWorkspaceCoordinates ? 1 : this.workspace_.scale; return { diff --git a/core/gesture.ts b/core/gesture.ts index a71eb861e..0b65299e5 100644 --- a/core/gesture.ts +++ b/core/gesture.ts @@ -146,7 +146,7 @@ export class Gesture { private mostRecentEvent: PointerEvent; /** Boolean for whether or not this gesture is a multi-touch gesture. */ - private isMultiTouch_ = false; + private multiTouch = false; /** A map of cached points used for tracking multi-touch gestures. */ private cachedPoints = new Map(); @@ -586,7 +586,7 @@ export class Gesture { const point0 = this.cachedPoints.get(pointers[0])!; const point1 = this.cachedPoints.get(pointers[1])!; this.startDistance = Coordinate.distance(point0, point1); - this.isMultiTouch_ = true; + this.multiTouch = true; e.preventDefault(); } } @@ -691,7 +691,7 @@ export class Gesture { * @internal */ isMultiTouch(): boolean { - return this.isMultiTouch_; + return this.multiTouch; } /** diff --git a/core/marker_manager.ts b/core/marker_manager.ts index bd243c005..d7035534d 100644 --- a/core/marker_manager.ts +++ b/core/marker_manager.ts @@ -23,16 +23,16 @@ export class MarkerManager { static readonly LOCAL_MARKER = 'local_marker_1'; /** The cursor. */ - private cursor_: Cursor | null = null; + private cursor: Cursor | null = null; /** The cursor's SVG element. */ - private cursorSvg_: SVGElement | null = null; + private cursorSvg: SVGElement | null = null; /** The map of markers for the workspace. */ private markers = new Map(); /** The marker's SVG element. */ - private markerSvg_: SVGElement | null = null; + private markerSvg: SVGElement | null = null; /** * @param workspace The workspace for the marker manager. @@ -83,7 +83,7 @@ export class MarkerManager { * @returns The cursor for this workspace. */ getCursor(): Cursor | null { - return this.cursor_; + return this.cursor; } /** @@ -104,16 +104,16 @@ export class MarkerManager { * @param cursor The cursor used to move around this workspace. */ setCursor(cursor: Cursor) { - if (this.cursor_ && this.cursor_.getDrawer()) { - this.cursor_.getDrawer().dispose(); + if (this.cursor && this.cursor.getDrawer()) { + this.cursor.getDrawer().dispose(); } - this.cursor_ = cursor; - if (this.cursor_) { + this.cursor = cursor; + if (this.cursor) { const drawer = this.workspace .getRenderer() - .makeMarkerDrawer(this.workspace, this.cursor_); - this.cursor_.setDrawer(drawer); - this.setCursorSvg(this.cursor_.getDrawer().createDom()); + .makeMarkerDrawer(this.workspace, this.cursor); + this.cursor.setDrawer(drawer); + this.setCursorSvg(this.cursor.getDrawer().createDom()); } } @@ -126,12 +126,12 @@ export class MarkerManager { */ setCursorSvg(cursorSvg: SVGElement | null) { if (!cursorSvg) { - this.cursorSvg_ = null; + this.cursorSvg = null; return; } this.workspace.getBlockCanvas()!.appendChild(cursorSvg); - this.cursorSvg_ = cursorSvg; + this.cursorSvg = cursorSvg; } /** @@ -143,15 +143,15 @@ export class MarkerManager { */ setMarkerSvg(markerSvg: SVGElement | null) { if (!markerSvg) { - this.markerSvg_ = null; + this.markerSvg = null; return; } if (this.workspace.getBlockCanvas()) { - if (this.cursorSvg_) { + if (this.cursorSvg) { this.workspace .getBlockCanvas()! - .insertBefore(markerSvg, this.cursorSvg_); + .insertBefore(markerSvg, this.cursorSvg); } else { this.workspace.getBlockCanvas()!.appendChild(markerSvg); } @@ -164,7 +164,7 @@ export class MarkerManager { * @internal */ updateMarkers() { - if (this.workspace.keyboardAccessibilityMode && this.cursorSvg_) { + if (this.workspace.keyboardAccessibilityMode && this.cursorSvg) { this.workspace.getCursor()!.draw(); } } @@ -181,9 +181,9 @@ export class MarkerManager { this.unregisterMarker(markerId); } this.markers.clear(); - if (this.cursor_) { - this.cursor_.dispose(); - this.cursor_ = null; + if (this.cursor) { + this.cursor.dispose(); + this.cursor = null; } } } diff --git a/core/options.ts b/core/options.ts index 42d2b41de..539fd3f6f 100644 --- a/core/options.ts +++ b/core/options.ts @@ -167,7 +167,7 @@ export class Options { this.modalInputs = modalInputs; this.pathToMedia = pathToMedia; this.hasCategories = hasCategories; - this.moveOptions = Options.parseMoveOptions_(options, hasCategories); + this.moveOptions = Options.parseMoveOptions(options, hasCategories); this.hasScrollbars = !!this.moveOptions.scrollbars; this.hasTrashcan = hasTrashcan; this.maxTrashcanContents = maxTrashcanContents; @@ -175,10 +175,10 @@ export class Options { this.hasCss = hasCss; this.horizontalLayout = horizontalLayout; this.languageTree = toolboxJsonDef; - this.gridOptions = Options.parseGridOptions_(options); - this.zoomOptions = Options.parseZoomOptions_(options); + this.gridOptions = Options.parseGridOptions(options); + this.zoomOptions = Options.parseZoomOptions(options); this.toolboxPosition = toolboxPosition; - this.theme = Options.parseThemeOptions_(options); + this.theme = Options.parseThemeOptions(options); this.renderer = renderer; this.rendererOverrides = options['rendererOverrides'] ?? null; @@ -201,7 +201,7 @@ export class Options { * @param hasCategories Whether the workspace has categories or not. * @returns Normalized move options. */ - private static parseMoveOptions_( + private static parseMoveOptions( options: BlocklyOptions, hasCategories: boolean, ): MoveOptions { @@ -260,7 +260,7 @@ export class Options { * @param options Dictionary of options. * @returns Normalized zoom options. */ - private static parseZoomOptions_(options: BlocklyOptions): ZoomOptions { + private static parseZoomOptions(options: BlocklyOptions): ZoomOptions { const zoom = options['zoom'] || {}; const zoomOptions = {} as ZoomOptions; if (zoom['controls'] === undefined) { @@ -309,7 +309,7 @@ export class Options { * @param options Dictionary of options. * @returns Normalized grid options. */ - private static parseGridOptions_(options: BlocklyOptions): GridOptions { + private static parseGridOptions(options: BlocklyOptions): GridOptions { const grid = options['grid'] || {}; const gridOptions = {} as GridOptions; gridOptions.spacing = Number(grid['spacing']) || 0; @@ -327,7 +327,7 @@ export class Options { * @param options Dictionary of options. * @returns A Blockly Theme. */ - private static parseThemeOptions_(options: BlocklyOptions): Theme { + private static parseThemeOptions(options: BlocklyOptions): Theme { const theme = options['theme'] || Classic; if (typeof theme === 'string') { return registry.getObject(registry.Type.THEME, theme) as Theme; diff --git a/core/scrollbar_pair.ts b/core/scrollbar_pair.ts index 231fe56f8..79ecff834 100644 --- a/core/scrollbar_pair.ts +++ b/core/scrollbar_pair.ts @@ -27,7 +27,7 @@ export class ScrollbarPair { corner_: SVGRectElement | null = null; /** Previously recorded metrics from the workspace. */ - private oldHostMetrics_: Metrics | null = null; + private oldHostMetrics: Metrics | null = null; /** * @param workspace Workspace to bind the scrollbars to. @@ -84,7 +84,7 @@ export class ScrollbarPair { dispose() { dom.removeNode(this.corner_); this.corner_ = null; - this.oldHostMetrics_ = null; + this.oldHostMetrics = null; if (this.hScroll) { this.hScroll.dispose(); this.hScroll = null; @@ -111,11 +111,11 @@ export class ScrollbarPair { let resizeH = false; let resizeV = false; if ( - !this.oldHostMetrics_ || - this.oldHostMetrics_.viewWidth !== hostMetrics.viewWidth || - this.oldHostMetrics_.viewHeight !== hostMetrics.viewHeight || - this.oldHostMetrics_.absoluteTop !== hostMetrics.absoluteTop || - this.oldHostMetrics_.absoluteLeft !== hostMetrics.absoluteLeft + !this.oldHostMetrics || + this.oldHostMetrics.viewWidth !== hostMetrics.viewWidth || + this.oldHostMetrics.viewHeight !== hostMetrics.viewHeight || + this.oldHostMetrics.absoluteTop !== hostMetrics.absoluteTop || + this.oldHostMetrics.absoluteLeft !== hostMetrics.absoluteLeft ) { // The window has been resized or repositioned. resizeH = true; @@ -123,18 +123,18 @@ export class ScrollbarPair { } else { // Has the content been resized or moved? if ( - !this.oldHostMetrics_ || - this.oldHostMetrics_.scrollWidth !== hostMetrics.scrollWidth || - this.oldHostMetrics_.viewLeft !== hostMetrics.viewLeft || - this.oldHostMetrics_.scrollLeft !== hostMetrics.scrollLeft + !this.oldHostMetrics || + this.oldHostMetrics.scrollWidth !== hostMetrics.scrollWidth || + this.oldHostMetrics.viewLeft !== hostMetrics.viewLeft || + this.oldHostMetrics.scrollLeft !== hostMetrics.scrollLeft ) { resizeH = true; } if ( - !this.oldHostMetrics_ || - this.oldHostMetrics_.scrollHeight !== hostMetrics.scrollHeight || - this.oldHostMetrics_.viewTop !== hostMetrics.viewTop || - this.oldHostMetrics_.scrollTop !== hostMetrics.scrollTop + !this.oldHostMetrics || + this.oldHostMetrics.scrollHeight !== hostMetrics.scrollHeight || + this.oldHostMetrics.viewTop !== hostMetrics.viewTop || + this.oldHostMetrics.scrollTop !== hostMetrics.scrollTop ) { resizeV = true; } @@ -158,23 +158,23 @@ export class ScrollbarPair { if (this.hScroll && this.vScroll) { // Reposition the corner square. if ( - !this.oldHostMetrics_ || - this.oldHostMetrics_.viewWidth !== hostMetrics.viewWidth || - this.oldHostMetrics_.absoluteLeft !== hostMetrics.absoluteLeft + !this.oldHostMetrics || + this.oldHostMetrics.viewWidth !== hostMetrics.viewWidth || + this.oldHostMetrics.absoluteLeft !== hostMetrics.absoluteLeft ) { this.corner_?.setAttribute('x', String(this.vScroll.position.x)); } if ( - !this.oldHostMetrics_ || - this.oldHostMetrics_.viewHeight !== hostMetrics.viewHeight || - this.oldHostMetrics_.absoluteTop !== hostMetrics.absoluteTop + !this.oldHostMetrics || + this.oldHostMetrics.viewHeight !== hostMetrics.viewHeight || + this.oldHostMetrics.absoluteTop !== hostMetrics.absoluteTop ) { this.corner_?.setAttribute('y', String(this.hScroll.position.y)); } } // Cache the current metrics to potentially short-cut the next resize event. - this.oldHostMetrics_ = hostMetrics; + this.oldHostMetrics = hostMetrics; } /** diff --git a/core/shortcut_registry.ts b/core/shortcut_registry.ts index 32615c866..09bd867e7 100644 --- a/core/shortcut_registry.ts +++ b/core/shortcut_registry.ts @@ -242,7 +242,7 @@ export class ShortcutRegistry { * @returns True if the event was handled, false otherwise. */ onKeyDown(workspace: WorkspaceSvg, e: KeyboardEvent): boolean { - const key = this.serializeKeyEvent_(e); + const key = this.serializeKeyEvent(e); const shortcutNames = this.getShortcutNamesByKeyCode(key); if (!shortcutNames) return false; for (const shortcutName of shortcutNames) { @@ -294,7 +294,7 @@ export class ShortcutRegistry { * @param e A key down event. * @returns The serialized key code for the given event. */ - private serializeKeyEvent_(e: KeyboardEvent): string { + private serializeKeyEvent(e: KeyboardEvent): string { let serializedKey = ''; for (const modifier in ShortcutRegistry.modifierKeys) { if (e.getModifierState(modifier)) { @@ -318,7 +318,7 @@ export class ShortcutRegistry { * @param modifiers List of modifiers to be used with the key. * @throws {Error} if the modifier is not in the valid modifiers list. */ - private checkModifiers_(modifiers: KeyCodes[]) { + private checkModifiers(modifiers: KeyCodes[]) { for (const modifier of modifiers) { if (!(modifier in ShortcutRegistry.modifierKeys)) { throw new Error(modifier + ' is not a valid modifier key.'); @@ -338,7 +338,7 @@ export class ShortcutRegistry { let serializedKey = ''; if (modifiers) { - this.checkModifiers_(modifiers); + this.checkModifiers(modifiers); for (const modifier in ShortcutRegistry.modifierKeys) { const modifierKeyCode = ( ShortcutRegistry.modifierKeys as AnyDuringMigration diff --git a/core/theme_manager.ts b/core/theme_manager.ts index 8d2ad72db..966ca3fd2 100644 --- a/core/theme_manager.ts +++ b/core/theme_manager.ts @@ -23,7 +23,7 @@ import type {WorkspaceSvg} from './workspace_svg.js'; */ export class ThemeManager { /** A list of workspaces that are subscribed to this theme. */ - private subscribedWorkspaces_: Workspace[] = []; + private subscribedWorkspaces: Workspace[] = []; private componentDB = new Map(); /** @@ -73,7 +73,7 @@ export class ThemeManager { // Refresh all subscribed workspaces. for ( let i = 0, workspace; - (workspace = this.subscribedWorkspaces_[i]); + (workspace = this.subscribedWorkspaces[i]); i++ ) { (workspace as WorkspaceSvg).refreshTheme(); @@ -89,7 +89,7 @@ export class ThemeManager { } } - for (const workspace of this.subscribedWorkspaces_) { + for (const workspace of this.subscribedWorkspaces) { (workspace as WorkspaceSvg).hideChaff(); } } @@ -102,7 +102,7 @@ export class ThemeManager { * @internal */ subscribeWorkspace(workspace: Workspace) { - this.subscribedWorkspaces_.push(workspace); + this.subscribedWorkspaces.push(workspace); } /** @@ -112,7 +112,7 @@ export class ThemeManager { * @internal */ unsubscribeWorkspace(workspace: Workspace) { - if (!arrayUtils.removeElem(this.subscribedWorkspaces_, workspace)) { + if (!arrayUtils.removeElem(this.subscribedWorkspaces, workspace)) { throw Error( "Cannot unsubscribe a workspace that hasn't been subscribed.", ); @@ -176,7 +176,7 @@ export class ThemeManager { * @internal */ dispose() { - this.subscribedWorkspaces_.length = 0; + this.subscribedWorkspaces.length = 0; this.componentDB.clear(); } } diff --git a/core/toolbox/category.ts b/core/toolbox/category.ts index 5bdeca223..1394f7218 100644 --- a/core/toolbox/category.ts +++ b/core/toolbox/category.ts @@ -347,9 +347,9 @@ export class ToolboxCategory '" must not have both a style and a colour', ); } else if (styleName) { - return this.getColourfromStyle_(styleName); + return this.getColourfromStyle(styleName); } else if (colour) { - return this.parseColour_(colour); + return this.parseColour(colour); } return ''; } @@ -361,12 +361,12 @@ export class ToolboxCategory * @param styleName Name of the style. * @returns The hex colour for the category. */ - private getColourfromStyle_(styleName: string): string { + private getColourfromStyle(styleName: string): string { const theme = this.workspace_.getTheme(); if (styleName && theme) { const style = theme.categoryStyles[styleName]; if (style && style.colour) { - return this.parseColour_(style.colour); + return this.parseColour(style.colour); } else { console.warn( 'Style "' + styleName + '" must exist and contain a colour value', @@ -395,7 +395,7 @@ export class ToolboxCategory * reference string pointing to one of those two values. * @returns The hex colour for the category. */ - private parseColour_(colourValue: number | string): string { + private parseColour(colourValue: number | string): string { // Decode the colour for any potential message references // (eg. `%{BKY_MATH_HUE}`). const colour = parsing.replaceMessageReferences(colourValue); @@ -541,7 +541,7 @@ export class ToolboxCategory } const className = this.cssConfig_['selected']; if (isSelected) { - const defaultColour = this.parseColour_( + const defaultColour = this.parseColour( ToolboxCategory.defaultBackgroundColour, ); this.rowDiv_.style.backgroundColor = this.colour_ || defaultColour; diff --git a/core/toolbox/collapsible_category.ts b/core/toolbox/collapsible_category.ts index e51db4f68..591436425 100644 --- a/core/toolbox/collapsible_category.ts +++ b/core/toolbox/collapsible_category.ts @@ -83,7 +83,7 @@ export class CollapsibleToolboxCategory this.flyoutItems_.push(flyoutItem); prevIsFlyoutItem = true; } else { - this.createToolboxItem_(itemDef); + this.createToolboxItem(itemDef); prevIsFlyoutItem = false; } } @@ -95,7 +95,7 @@ export class CollapsibleToolboxCategory * * @param itemDef The information needed to create a toolbox item. */ - private createToolboxItem_(itemDef: toolbox.ToolboxItemInfo) { + private createToolboxItem(itemDef: toolbox.ToolboxItemInfo) { let registryName = itemDef['kind']; const categoryDef = itemDef as toolbox.CategoryInfo; // Categories that are collapsible are created using a class registered diff --git a/core/toolbox/separator.ts b/core/toolbox/separator.ts index 5e899054a..23874e42e 100644 --- a/core/toolbox/separator.ts +++ b/core/toolbox/separator.ts @@ -29,7 +29,7 @@ export class ToolboxSeparator extends ToolboxItem { /** All the CSS class names that are used to create a separator. */ protected cssConfig_: CssConfig = {'container': 'blocklyTreeSeparator'}; - private htmlDiv_: HTMLDivElement | null = null; + private htmlDiv: HTMLDivElement | null = null; /** * @param separatorDef The information needed to create a separator. @@ -58,16 +58,16 @@ export class ToolboxSeparator extends ToolboxItem { if (className) { dom.addClass(container, className); } - this.htmlDiv_ = container; + this.htmlDiv = container; return container; } override getDiv() { - return this.htmlDiv_ as HTMLDivElement; + return this.htmlDiv as HTMLDivElement; } override dispose() { - dom.removeNode(this.htmlDiv_ as HTMLDivElement); + dom.removeNode(this.htmlDiv as HTMLDivElement); } } diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index 5d6eee90a..457d5d43b 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -59,7 +59,7 @@ export class Toolbox */ override id = 'toolbox'; protected toolboxDef_: toolbox.ToolboxInfo; - private readonly horizontalLayout_: boolean; + private readonly horizontalLayout: boolean; /** The HTML container for the toolbox. */ HtmlDiv: HTMLDivElement | null = null; @@ -81,7 +81,7 @@ export class Toolbox RTL: boolean; /** The flyout for the toolbox. */ - private flyout_: IFlyout | null = null; + private flyout: IFlyout | null = null; protected contentMap_: {[key: string]: IToolboxItem}; toolboxPosition: toolbox.Position; @@ -113,7 +113,7 @@ export class Toolbox }; /** Whether the toolbox should be laid out horizontally. */ - this.horizontalLayout_ = workspace.options.horizontalLayout; + this.horizontalLayout = workspace.options.horizontalLayout; /** Is RTL vs LTR. */ this.RTL = workspace.options.RTL; @@ -140,12 +140,12 @@ export class Toolbox const workspace = this.workspace_; const svg = workspace.getParentSvg(); - this.flyout_ = this.createFlyout_(); + this.flyout = this.createFlyout_(); this.HtmlDiv = this.createDom_(this.workspace_); - dom.insertAfter(this.flyout_.createDom('svg'), svg); + dom.insertAfter(this.flyout.createDom('svg'), svg); this.setVisible(true); - this.flyout_.init(workspace); + this.flyout.init(workspace); this.render(this.toolboxDef_); const themeManager = workspace.getThemeManager(); @@ -281,16 +281,16 @@ export class Toolbox let handled = false; switch (e.key) { case 'ArrowDown': - handled = this.selectNext_(); + handled = this.selectNext(); break; case 'ArrowUp': - handled = this.selectPrevious_(); + handled = this.selectPrevious(); break; case 'ArrowLeft': - handled = this.selectParent_(); + handled = this.selectParent(); break; case 'ArrowRight': - handled = this.selectChild_(); + handled = this.selectChild(); break; case 'Enter': case ' ': @@ -391,7 +391,7 @@ export class Toolbox const fragment = document.createDocumentFragment(); for (let i = 0; i < toolboxDef.length; i++) { const toolboxItemDef = toolboxDef[i]; - this.createToolboxItem_(toolboxItemDef, fragment); + this.createToolboxItem(toolboxItemDef, fragment); } this.contentsDiv_!.appendChild(fragment); } @@ -403,7 +403,7 @@ export class Toolbox * the toolbox. * @param fragment The document fragment to add the child toolbox elements to. */ - private createToolboxItem_( + private createToolboxItem( toolboxItemDef: toolbox.ToolboxItemInfo, fragment: DocumentFragment, ) { @@ -644,7 +644,7 @@ export class Toolbox * @returns The toolbox flyout. */ getFlyout(): IFlyout | null { - return this.flyout_; + return this.flyout; } /** @@ -682,7 +682,7 @@ export class Toolbox * vertical. */ isHorizontal(): boolean { - return this.horizontalLayout_; + return this.horizontalLayout; } /** @@ -697,7 +697,7 @@ export class Toolbox return; } - if (this.horizontalLayout_) { + if (this.horizontalLayout) { toolboxDiv.style.left = '0'; toolboxDiv.style.height = 'auto'; toolboxDiv.style.width = '100%'; @@ -720,7 +720,7 @@ export class Toolbox this.width_ = toolboxDiv.offsetWidth; this.height_ = workspaceMetrics.viewHeight; } - this.flyout_!.position(); + this.flyout!.position(); } /** @@ -780,7 +780,7 @@ export class Toolbox this.selectedItem_.isSelectable() && this.selectedItem_.getContents().length ) { - this.flyout_!.show(this.selectedItem_.getContents()); + this.flyout!.show(this.selectedItem_.getContents()); } } @@ -808,7 +808,7 @@ export class Toolbox * Flyouts should not be closed if this is true. */ autoHide(onlyClosePopups: boolean) { - if (!onlyClosePopups && this.flyout_ && this.flyout_.autoClose) { + if (!onlyClosePopups && this.flyout && this.flyout.autoClose) { this.clearSelection(); } } @@ -838,7 +838,7 @@ export class Toolbox } this.updateFlyout_(oldItem, newItem); - this.fireSelectEvent_(oldItem, newItem); + this.fireSelectEvent(oldItem, newItem); } /** @@ -940,10 +940,10 @@ export class Toolbox (oldItem === newItem && !newItem.isCollapsible()) || !newItem.getContents().length ) { - this.flyout_!.hide(); + this.flyout!.hide(); } else { - this.flyout_!.show(newItem.getContents()); - this.flyout_!.scrollToStart(); + this.flyout!.show(newItem.getContents()); + this.flyout!.scrollToStart(); } } @@ -953,7 +953,7 @@ export class Toolbox * @param oldItem The previously selected toolbox item. * @param newItem The newly selected toolbox item. */ - private fireSelectEvent_( + private fireSelectEvent( oldItem: ISelectableToolboxItem | null, newItem: ISelectableToolboxItem | null, ) { @@ -976,7 +976,7 @@ export class Toolbox * * @returns True if a parent category was selected, false otherwise. */ - private selectParent_(): boolean { + private selectParent(): boolean { if (!this.selectedItem_) { return false; } @@ -1004,7 +1004,7 @@ export class Toolbox * * @returns True if a child category was selected, false otherwise. */ - private selectChild_(): boolean { + private selectChild(): boolean { if (!this.selectedItem_ || !this.selectedItem_.isCollapsible()) { return false; } @@ -1013,7 +1013,7 @@ export class Toolbox collapsibleItem.toggleExpanded(); return true; } else { - this.selectNext_(); + this.selectNext(); return true; } } @@ -1023,7 +1023,7 @@ export class Toolbox * * @returns True if a next category was selected, false otherwise. */ - private selectNext_(): boolean { + private selectNext(): boolean { if (!this.selectedItem_) { return false; } @@ -1047,7 +1047,7 @@ export class Toolbox * * @returns True if a previous category was selected, false otherwise. */ - private selectPrevious_(): boolean { + private selectPrevious(): boolean { if (!this.selectedItem_) { return false; } @@ -1069,7 +1069,7 @@ export class Toolbox /** Disposes of this toolbox. */ dispose() { this.workspace_.getComponentManager().removeComponent('toolbox'); - this.flyout_!.dispose(); + this.flyout!.dispose(); for (let i = 0; i < this.contents_.length; i++) { const toolboxItem = this.contents_[i]; toolboxItem.dispose(); diff --git a/core/variable_map.ts b/core/variable_map.ts index a67461741..b28e8a355 100644 --- a/core/variable_map.ts +++ b/core/variable_map.ts @@ -76,14 +76,9 @@ export class VariableMap { // The IDs may match if the rename is a simple case change (name1 -> // Name1). if (!conflictVar || conflictVar.getId() === variable.getId()) { - this.renameVariableAndUses_(variable, newName, blocks); + this.renameVariableAndUses(variable, newName, blocks); } else { - this.renameVariableWithConflict_( - variable, - newName, - conflictVar, - blocks, - ); + this.renameVariableWithConflict(variable, newName, conflictVar, blocks); } } finally { eventUtils.setGroup(existingGroup); @@ -114,7 +109,7 @@ export class VariableMap { * @param newName New variable name. * @param blocks The list of all blocks in the workspace. */ - private renameVariableAndUses_( + private renameVariableAndUses( variable: VariableModel, newName: string, blocks: Block[], @@ -139,7 +134,7 @@ export class VariableMap { * @param conflictVar The variable that was already using newName. * @param blocks The list of all blocks in the workspace. */ - private renameVariableWithConflict_( + private renameVariableWithConflict( variable: VariableModel, newName: string, conflictVar: VariableModel, @@ -150,7 +145,7 @@ export class VariableMap { if (newName !== oldCase) { // Simple rename to change the case and update references. - this.renameVariableAndUses_(conflictVar, newName, blocks); + this.renameVariableAndUses(conflictVar, newName, blocks); } // These blocks now refer to a different variable. diff --git a/core/variable_model.ts b/core/variable_model.ts index 0728a3d56..58e48f362 100644 --- a/core/variable_model.ts +++ b/core/variable_model.ts @@ -25,7 +25,7 @@ import type {Workspace} from './workspace.js'; */ export class VariableModel { type: string; - private readonly id_: string; + private readonly id: string; /** * @param workspace The variable's workspace. @@ -56,12 +56,12 @@ export class VariableModel { * not change, even if the name changes. In most cases this should be a * UUID. */ - this.id_ = opt_id || idGenerator.genUid(); + this.id = opt_id || idGenerator.genUid(); } /** @returns The ID for the variable. */ getId(): string { - return this.id_; + return this.id; } /** diff --git a/core/workspace.ts b/core/workspace.ts index 75bcd8147..89c797237 100644 --- a/core/workspace.ts +++ b/core/workspace.ts @@ -167,7 +167,7 @@ export class Workspace implements IASTNodeLocation { * @returns The comparison value. This tells Array.sort() how to change object * a's index. */ - private sortObjects_( + private sortObjects( a: Block | WorkspaceComment, b: Block | WorkspaceComment, ): number { @@ -209,7 +209,7 @@ export class Workspace implements IASTNodeLocation { // Copy the topBlocks list. const blocks = new Array().concat(this.topBlocks); if (ordered && blocks.length > 1) { - blocks.sort(this.sortObjects_.bind(this)); + blocks.sort(this.sortObjects.bind(this)); } return blocks; } @@ -252,7 +252,7 @@ export class Workspace implements IASTNodeLocation { } const blocks = this.typedBlocksDB.get(type)!.slice(0); if (ordered && blocks && blocks.length > 1) { - blocks.sort(this.sortObjects_.bind(this)); + blocks.sort(this.sortObjects.bind(this)); } return blocks.filter((block) => !block.isInsertionMarker()); @@ -308,7 +308,7 @@ export class Workspace implements IASTNodeLocation { // Copy the topComments list. const comments = new Array().concat(this.topComments); if (ordered && comments.length > 1) { - comments.sort(this.sortObjects_.bind(this)); + comments.sort(this.sortObjects.bind(this)); } return comments; } diff --git a/core/workspace_audio.ts b/core/workspace_audio.ts index c8d21080c..1759b30ed 100644 --- a/core/workspace_audio.ts +++ b/core/workspace_audio.ts @@ -29,7 +29,7 @@ export class WorkspaceAudio { private sounds = new Map(); /** Time that the last sound was played. */ - private lastSound_: Date | null = null; + private lastSound: Date | null = null; /** Whether the audio is muted or not. */ private muted: boolean = false; @@ -132,12 +132,12 @@ export class WorkspaceAudio { // Don't play one sound on top of another. const now = new Date(); if ( - this.lastSound_ !== null && - now.getTime() - this.lastSound_.getTime() < SOUND_LIMIT + this.lastSound !== null && + now.getTime() - this.lastSound.getTime() < SOUND_LIMIT ) { return; } - this.lastSound_ = now; + this.lastSound = now; let mySound; if (userAgent.IPAD || userAgent.ANDROID) { // Creating a new audio node causes lag in Android and iPad. Android diff --git a/core/workspace_dragger.ts b/core/workspace_dragger.ts index b9318b6d5..7ad5651f7 100644 --- a/core/workspace_dragger.ts +++ b/core/workspace_dragger.ts @@ -21,17 +21,17 @@ import type {WorkspaceSvg} from './workspace_svg.js'; * */ export class WorkspaceDragger { - private readonly horizontalScrollEnabled_: boolean; - private readonly verticalScrollEnabled_: boolean; + private readonly horizontalScrollEnabled: boolean; + private readonly verticalScrollEnabled: boolean; protected startScrollXY_: Coordinate; /** @param workspace The workspace to drag. */ constructor(private workspace: WorkspaceSvg) { /** Whether horizontal scroll is enabled. */ - this.horizontalScrollEnabled_ = this.workspace.isMovableHorizontally(); + this.horizontalScrollEnabled = this.workspace.isMovableHorizontally(); /** Whether vertical scroll is enabled. */ - this.verticalScrollEnabled_ = this.workspace.isMovableVertically(); + this.verticalScrollEnabled = this.workspace.isMovableVertically(); /** * The scroll position of the workspace at the beginning of the drag. @@ -84,11 +84,11 @@ export class WorkspaceDragger { drag(currentDragDeltaXY: Coordinate) { const newXY = Coordinate.sum(this.startScrollXY_, currentDragDeltaXY); - if (this.horizontalScrollEnabled_ && this.verticalScrollEnabled_) { + if (this.horizontalScrollEnabled && this.verticalScrollEnabled) { this.workspace.scroll(newXY.x, newXY.y); - } else if (this.horizontalScrollEnabled_) { + } else if (this.horizontalScrollEnabled) { this.workspace.scroll(newXY.x, this.workspace.scrollY); - } else if (this.verticalScrollEnabled_) { + } else if (this.verticalScrollEnabled) { this.workspace.scroll(this.workspace.scrollX, newXY.y); } else { throw new TypeError('Invalid state.'); diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index fed5e3cb1..faebcda97 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -104,7 +104,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * Whether the workspace is visible. False if the workspace has been hidden * by calling `setVisible(false)`. */ - private isVisible_ = true; + private visible = true; /** * Whether this workspace has resizes enabled. @@ -209,7 +209,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * Category-based toolbox providing blocks which may be dragged into this * workspace. */ - private toolbox_: IToolbox | null = null; + private toolbox: IToolbox | null = null; /** * The current gesture in progress on this workspace, if any. @@ -340,7 +340,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { /** Translates the workspace. */ this.setMetrics = - options.setMetrics || WorkspaceSvg.setTopLevelWorkspaceMetrics_; + options.setMetrics || WorkspaceSvg.setTopLevelWorkspaceMetrics; this.componentManager = new ComponentManager(); @@ -540,14 +540,14 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { } // Update all blocks in workspace that have a style name. - this.updateBlockStyles_( + this.updateBlockStyles( this.getAllBlocks(false).filter((block) => !!block.getStyleName()), ); // Update current toolbox selection. this.refreshToolboxSelection(); - if (this.toolbox_) { - this.toolbox_.refreshTheme(); + if (this.toolbox) { + this.toolbox.refreshTheme(); } // Re-render if workspace is visible @@ -567,7 +567,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * * @param blocks List of blocks to update the style on. */ - private updateBlockStyles_(blocks: Block[]) { + private updateBlockStyles(blocks: Block[]) { for (let i = 0, block; (block = blocks[i]); i++) { const blockStyleName = block.getStyleName(); if (blockStyleName) { @@ -608,7 +608,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * False if the workspace has been hidden by calling `setVisible(false)`. */ isVisible(): boolean { - return this.isVisible_; + return this.visible; } /** @@ -781,7 +781,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.svgGroup_, 'pointerdown', this, - this.onMouseDown_, + this.onMouseDown, false, ); // This no-op works around https://bugs.webkit.org/show_bug.cgi?id=226683, @@ -793,7 +793,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.svgGroup_, 'wheel', this, - this.onMouseWheel_, + this.onMouseWheel, ); } @@ -805,7 +805,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { this.options, true, ); - this.toolbox_ = new ToolboxClass!(this); + this.toolbox = new ToolboxClass!(this); } if (this.grid) { this.grid.update(this.scale); @@ -835,9 +835,9 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (this.svgGroup_) { dom.removeNode(this.svgGroup_); } - if (this.toolbox_) { - this.toolbox_.dispose(); - this.toolbox_ = null; + if (this.toolbox) { + this.toolbox.dispose(); + this.toolbox = null; } if (this.flyout) { this.flyout.dispose(); @@ -994,8 +994,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (this.flyout || opt_own) { return this.flyout; } - if (this.toolbox_) { - return this.toolbox_.getFlyout(); + if (this.toolbox) { + return this.toolbox.getFlyout(); } return null; } @@ -1006,14 +1006,14 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @returns The toolbox on this workspace. */ getToolbox(): IToolbox | null { - return this.toolbox_; + return this.toolbox; } /** * Update items that use screen coordinate calculations * because something has changed (e.g. scroll position, window size). */ - private updateScreenCalculations_() { + private updateScreenCalculations() { this.updateInverseScreenCTM(); this.recordDragTargets(); } @@ -1043,8 +1043,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * trash, zoom, toolbox, etc. (e.g. window resize). */ resize() { - if (this.toolbox_) { - this.toolbox_.position(); + if (this.toolbox) { + this.toolbox.position(); } if (this.flyout) { this.flyout.position(); @@ -1067,7 +1067,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { if (this.scrollbar) { this.scrollbar.resize(); } - this.updateScreenCalculations_(); + this.updateScreenCalculations(); } /** @@ -1081,7 +1081,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { const currScroll = svgMath.getDocumentScroll(); if (!Coordinate.equals(this.lastRecordedPageScroll, currScroll)) { this.lastRecordedPageScroll = currScroll; - this.updateScreenCalculations_(); + this.updateScreenCalculations(); } } /* eslint-enable indent */ @@ -1223,7 +1223,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @param isVisible True if workspace should be visible. */ setVisible(isVisible: boolean) { - this.isVisible_ = isVisible; + this.visible = isVisible; if (!this.svgGroup_) { return; } @@ -1241,9 +1241,9 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { } this.getParentSvg().style.display = isVisible ? 'block' : 'none'; - if (this.toolbox_) { + if (this.toolbox) { // Currently does not support toolboxes in mutators. - this.toolbox_.setVisible(isVisible); + this.toolbox.setVisible(isVisible); } if (!isVisible) { this.hideChaff(true); @@ -1310,8 +1310,8 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { */ refreshToolboxSelection() { const ws = this.isFlyout ? this.targetWorkspace : this; - if (ws && !ws.currentGesture_ && ws.toolbox_ && ws.toolbox_.getFlyout()) { - ws.toolbox_.refreshSelection(); + if (ws && !ws.currentGesture_ && ws.toolbox && ws.toolbox.getFlyout()) { + ws.toolbox.refreshSelection(); } } @@ -1431,7 +1431,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * * @param e Pointer down event. */ - private onMouseDown_(e: PointerEvent) { + private onMouseDown(e: PointerEvent) { const gesture = this.getGesture(e); if (gesture) { gesture.handleWsStart(e, this); @@ -1530,7 +1530,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * * @param e Mouse wheel event. */ - private onMouseWheel_(e: WheelEvent) { + private onMouseWheel(e: WheelEvent) { // Don't scroll or zoom anything if drag is in progress. if (Gesture.inProgress()) { e.preventDefault(); @@ -1724,11 +1724,11 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { } if (toolbox.hasCategories(parsedToolboxDef)) { - if (!this.toolbox_) { + if (!this.toolbox) { throw Error("Existing toolbox has no categories. Can't change mode."); } this.options.languageTree = parsedToolboxDef; - this.toolbox_.render(parsedToolboxDef); + this.toolbox.render(parsedToolboxDef); } else { if (!this.flyout) { throw Error("Existing toolbox has categories. Can't change mode."); @@ -2419,7 +2419,7 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @param xyRatio Contains an x and/or y property which is a float between 0 * and 1 specifying the degree of scrolling. */ - private static setTopLevelWorkspaceMetrics_( + private static setTopLevelWorkspaceMetrics( this: WorkspaceSvg, xyRatio: {x?: number; y?: number}, ) { diff --git a/tests/mocha/block_json_test.js b/tests/mocha/block_json_test.js index 6f286fa30..4baccef6b 100644 --- a/tests/mocha/block_json_test.js +++ b/tests/mocha/block_json_test.js @@ -21,25 +21,25 @@ suite('Block JSON initialization', function () { sharedTestTeardown.call(this); }); - suite('validateTokens_', function () { + suite('validateTokens', function () { setup(function () { this.assertError = function (tokens, count, error) { const block = { type: 'test', - validateTokens_: Blockly.Block.prototype.validateTokens_, + validateTokens: Blockly.Block.prototype.validateTokens, }; assert.throws(function () { - block.validateTokens_(tokens, count); + block.validateTokens(tokens, count); }, error); }; this.assertNoError = function (tokens, count) { const block = { type: 'test', - validateTokens_: Blockly.Block.prototype.validateTokens_, + validateTokens: Blockly.Block.prototype.validateTokens, }; assert.doesNotThrow(function () { - block.validateTokens_(tokens, count); + block.validateTokens(tokens, count); }); }; }); @@ -97,17 +97,17 @@ suite('Block JSON initialization', function () { }); }); - suite('interpolateArguments_', function () { + suite('interpolateArguments', function () { setup(function () { this.assertInterpolation = function (tokens, args, lastAlign, elements) { const block = { type: 'test', - interpolateArguments_: Blockly.Block.prototype.interpolateArguments_, - stringToFieldJson_: Blockly.Block.prototype.stringToFieldJson_, - isInputKeyword_: Blockly.Block.prototype.isInputKeyword_, + interpolateArguments: Blockly.Block.prototype.interpolateArguments, + stringToFieldJson: Blockly.Block.prototype.stringToFieldJson, + isInputKeyword: Blockly.Block.prototype.isInputKeyword, }; assert.deepEqual( - block.interpolateArguments_(tokens, args, lastAlign), + block.interpolateArguments(tokens, args, lastAlign), elements, ); }; @@ -381,7 +381,7 @@ suite('Block JSON initialization', function () { }); }); - suite('fieldFromJson_', function () { + suite('fieldFromJson', function () { setup(function () { this.stub = sinon .stub(Blockly.fieldRegistry.TEST_ONLY, 'fromJsonInternal') @@ -403,10 +403,10 @@ suite('Block JSON initialization', function () { this.assertField = function (json, expectedType) { const block = { type: 'test', - fieldFromJson_: Blockly.Block.prototype.fieldFromJson_, - stringToFieldJson_: Blockly.Block.prototype.stringToFieldJson_, + fieldFromJson: Blockly.Block.prototype.fieldFromJson, + stringToFieldJson: Blockly.Block.prototype.stringToFieldJson, }; - assert.strictEqual(block.fieldFromJson_(json), expectedType); + assert.strictEqual(block.fieldFromJson(json), expectedType); }; }); @@ -563,7 +563,7 @@ suite('Block JSON initialization', function () { }); }); - suite('inputFromJson_', function () { + suite('inputFromJson', function () { setup(function () { this.assertInput = function (json, type, check, align) { const block = this.workspace.newBlock('test_basic_empty'); @@ -571,7 +571,7 @@ suite('Block JSON initialization', function () { sinon.spy(block, 'appendValueInput'); sinon.spy(block, 'appendStatementInput'); - const input = block.inputFromJson_(json); + const input = block.inputFromJson(json); switch (type) { case 'input_dummy': assert.isTrue( @@ -667,7 +667,7 @@ suite('Block JSON initialization', function () { CustomInput, ); const block = this.workspace.newBlock('test_basic_empty'); - block.inputFromJson_({'type': 'custom'}); + block.inputFromJson({'type': 'custom'}); assert.instanceOf( block.inputList[0], CustomInput, diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index 3f0eba44b..a489fb3e3 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -2527,12 +2527,12 @@ suite('Blocks', function () { this.block.setColour('20'); assert.equal(this.block.getColour(), '#a5745b'); assert.equal(this.block.colour_, this.block.getColour()); - assert.equal(this.block.hue_, '20'); + assert.equal(this.block.getHue(), '20'); }); test('Set style', function () { this.block.setStyle('styleOne'); assert.equal(this.block.getStyleName(), 'styleOne'); - assert.isNull(this.block.hue_); + assert.isNull(this.block.getHue()); // Calling setStyle does not update the colour on a headless block. assert.equal(this.block.getColour(), '#000000'); }); @@ -2566,14 +2566,14 @@ suite('Blocks', function () { assert.equal(this.block.getStyleName(), 'auto_#a5745b'); assert.equal(this.block.getColour(), '#a5745b'); assert.equal(this.block.colour_, this.block.getColour()); - assert.equal(this.block.hue_, '20'); + assert.equal(this.block.getHue(), '20'); }); test('Set colour hex', function () { this.block.setColour('#000000'); assert.equal(this.block.getStyleName(), 'auto_#000000'); assert.equal(this.block.getColour(), '#000000'); assert.equal(this.block.colour_, this.block.getColour()); - assert.isNull(this.block.hue_); + assert.isNull(this.block.getHue()); }); test('Set style', function () { this.block.setStyle('styleOne'); diff --git a/tests/mocha/blocks/logic_ternary_test.js b/tests/mocha/blocks/logic_ternary_test.js index e6e3326ec..719209359 100644 --- a/tests/mocha/blocks/logic_ternary_test.js +++ b/tests/mocha/blocks/logic_ternary_test.js @@ -38,7 +38,7 @@ suite('Logic ternary', function () { const checkList = ifInput.connection.getCheck(); assert.equal(checkList.length, 1); assert.equal(checkList[0], 'Boolean'); - assert.exists(block.onchangeWrapper_, 'Has onchange handler'); + assert.exists(block.onchangeWrapper, 'Has onchange handler'); if (inputsInline) { assert.isTrue(block.inputsInline); } else { diff --git a/tests/mocha/blocks/procedures_test.js b/tests/mocha/blocks/procedures_test.js index 84dbf1746..4b20662cf 100644 --- a/tests/mocha/blocks/procedures_test.js +++ b/tests/mocha/blocks/procedures_test.js @@ -1622,7 +1622,7 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = 'proc name2'; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name2'); assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name2'); }); @@ -1635,7 +1635,7 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = 'PROC NAME'; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); assert.equal(this.defBlock.getFieldValue('NAME'), 'PROC NAME'); assert.equal(this.callBlock.getFieldValue('NAME'), 'PROC NAME'); }); @@ -1650,7 +1650,7 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = 'proc name'; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name'); assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name'); }); @@ -1663,7 +1663,7 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = 'proc name '; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name'); assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name'); }); @@ -1676,9 +1676,9 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = 'proc name '; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); defInput.htmlInput_.value = 'proc name 2'; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); assert.equal(this.defBlock.getFieldValue('NAME'), 'proc name 2'); assert.equal(this.callBlock.getFieldValue('NAME'), 'proc name 2'); }); @@ -1691,7 +1691,7 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = ''; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); assert.equal( this.defBlock.getFieldValue('NAME'), Blockly.Msg['UNNAMED_KEY'], @@ -1710,7 +1710,7 @@ suite('Procedures', function () { ); defInput.htmlInput_.value = ''; - defInput.onHtmlInputChange_(null); + defInput.onHtmlInputChange(null); const newDefBlock = this.workspace.newBlock(testSuite.defType); newDefBlock.setFieldValue('new name', 'NAME'); assert.equal( diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js index 2669cc854..84ea7f0d7 100644 --- a/tests/mocha/event_test.js +++ b/tests/mocha/event_test.js @@ -201,7 +201,7 @@ suite('Events', function () { suite('Block Move', function () { test('by coordinate', function () { const coordinate = new Blockly.utils.Coordinate(3, 4); - this.block.xy_ = coordinate; + this.block.xy = coordinate; const event = new Blockly.Events.BlockMove(this.block); sinon.assert.calledOnce(this.genUidStub); @@ -224,7 +224,7 @@ suite('Events', function () { try { this.parentBlock = createSimpleTestBlock(this.workspace); this.block.parentBlock_ = this.parentBlock; - this.block.xy_ = new Blockly.utils.Coordinate(3, 4); + this.block.xy = new Blockly.utils.Coordinate(3, 4); const event = new Blockly.Events.BlockMove(this.block); sinon.assert.calledTwice(this.genUidStub); assertEventEquals( @@ -331,7 +331,7 @@ suite('Events', function () { try { this.parentBlock = createSimpleTestBlock(this.workspace); this.block.parentBlock_ = this.parentBlock; - this.block.xy_ = new Blockly.utils.Coordinate(3, 4); + this.block.xy = new Blockly.utils.Coordinate(3, 4); const event = new Blockly.Events.BlockMove(this.block); sinon.assert.calledTwice(this.genUidStub); assertEventEquals( @@ -1284,7 +1284,7 @@ suite('Events', function () { suite('Filters', function () { function addMoveEvent(events, block, newX, newY) { events.push(new Blockly.Events.BlockMove(block)); - block.xy_ = new Blockly.utils.Coordinate(newX, newY); + block.xy = new Blockly.utils.Coordinate(newX, newY); events[events.length - 1].recordNew(); } diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index 3e0d8ca38..768766bf0 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -303,7 +303,7 @@ suite('Number Fields', function () { test('When Editing', function () { this.field.isBeingEdited_ = true; this.field.htmlInput_.value = String(suiteInfo.value); - this.field.onHtmlInputChange_(null); + this.field.onHtmlInputChange(null); assertFieldValue( this.field, suiteInfo.expectedValue, diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js index 70970b9bf..38f9662d6 100644 --- a/tests/mocha/field_test.js +++ b/tests/mocha/field_test.js @@ -626,7 +626,7 @@ suite('Abstract Fields', function () { const field = new Blockly.Field('value', null, { tooltip: 'test tooltip', }); - assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.getTooltip(), 'test tooltip'); }); test('JS Constructor - Dynamic', function () { const returnTooltip = function () { @@ -635,13 +635,13 @@ suite('Abstract Fields', function () { const field = new Blockly.Field('value', null, { tooltip: returnTooltip, }); - assert.equal(field.tooltip_, returnTooltip); + assert.equal(field.getTooltip(), returnTooltip()); }); test('JSON Definition', function () { const field = CustomField.fromJson({ tooltip: 'test tooltip', }); - assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.getTooltip(), 'test tooltip'); }); suite('W/ Msg References', function () { setup(function () { @@ -652,13 +652,13 @@ suite('Abstract Fields', function () { const field = new Blockly.Field('value', null, { tooltip: '%{BKY_TOOLTIP}', }); - assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.getTooltip(), 'test tooltip'); }); test('JSON Definition', function () { const field = CustomField.fromJson({ tooltip: '%{BKY_TOOLTIP}', }); - assert.equal(field.tooltip_, 'test tooltip'); + assert.equal(field.getTooltip(), 'test tooltip'); }); }); suite('setTooltip', function () { diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js index 3b755a543..7170b27ff 100644 --- a/tests/mocha/field_textinput_test.js +++ b/tests/mocha/field_textinput_test.js @@ -172,7 +172,7 @@ suite('Text Input Fields', function () { test('When Editing', function () { this.field.isBeingEdited_ = true; this.field.htmlInput_.value = suiteInfo.value; - this.field.onHtmlInputChange_(null); + this.field.onHtmlInputChange(null); assertFieldValue( this.field, suiteInfo.expectedValue, diff --git a/tests/mocha/keydown_test.js b/tests/mocha/keydown_test.js index da8129b48..0b72a7fee 100644 --- a/tests/mocha/keydown_test.js +++ b/tests/mocha/keydown_test.js @@ -68,7 +68,7 @@ suite('Key Down', function () { sinon.assert.notCalled(this.hideChaffSpy); }); test('Not called on hidden workspaces', function () { - this.workspace.isVisible_ = false; + this.workspace.visible = false; this.injectionDiv.dispatchEvent(this.event); sinon.assert.notCalled(this.hideChaffSpy); }); diff --git a/tests/mocha/shortcut_registry_test.js b/tests/mocha/shortcut_registry_test.js index cfd98a302..37c1b9c20 100644 --- a/tests/mocha/shortcut_registry_test.js +++ b/tests/mocha/shortcut_registry_test.js @@ -414,19 +414,19 @@ suite('Keyboard Shortcut Registry Test', function () { suite('serializeKeyEvent', function () { test('Serialize key', function () { const mockEvent = createKeyDownEvent(Blockly.utils.KeyCodes.A); - const serializedKey = this.registry.serializeKeyEvent_(mockEvent); + const serializedKey = this.registry.serializeKeyEvent(mockEvent); assert.equal(serializedKey, '65'); }); test('Serialize key code and modifier', function () { const mockEvent = createKeyDownEvent(Blockly.utils.KeyCodes.A, [ Blockly.utils.KeyCodes.CTRL, ]); - const serializedKey = this.registry.serializeKeyEvent_(mockEvent); + const serializedKey = this.registry.serializeKeyEvent(mockEvent); assert.equal(serializedKey, 'Control+65'); }); test('Serialize only a modifier', function () { const mockEvent = createKeyDownEvent(null, [Blockly.utils.KeyCodes.CTRL]); - const serializedKey = this.registry.serializeKeyEvent_(mockEvent); + const serializedKey = this.registry.serializeKeyEvent(mockEvent); assert.equal(serializedKey, 'Control'); }); test('Serialize multiple modifiers', function () { @@ -434,7 +434,7 @@ suite('Keyboard Shortcut Registry Test', function () { Blockly.utils.KeyCodes.CTRL, Blockly.utils.KeyCodes.SHIFT, ]); - const serializedKey = this.registry.serializeKeyEvent_(mockEvent); + const serializedKey = this.registry.serializeKeyEvent(mockEvent); assert.equal(serializedKey, 'Shift+Control'); }); test('Throw error when incorrect modifier', function () { diff --git a/tests/mocha/test_helpers/toolbox_definitions.js b/tests/mocha/test_helpers/toolbox_definitions.js index 2f767ed60..427331bcf 100644 --- a/tests/mocha/test_helpers/toolbox_definitions.js +++ b/tests/mocha/test_helpers/toolbox_definitions.js @@ -238,7 +238,7 @@ export function getBasicToolbox() { const workspace = new Blockly.WorkspaceSvg(new Blockly.Options({})); const toolbox = new Blockly.Toolbox(workspace); toolbox.HtmlDiv = document.createElement('div'); - toolbox.flyout_ = sinon.createStubInstance(Blockly.VerticalFlyout); + toolbox.flyout = sinon.createStubInstance(Blockly.VerticalFlyout); return toolbox; } diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js index b723e7038..70f5ff8f9 100644 --- a/tests/mocha/toolbox_test.js +++ b/tests/mocha/toolbox_test.js @@ -82,7 +82,7 @@ suite('Toolbox', function () { const componentManager = this.toolbox.workspace_.getComponentManager(); sinon.stub(componentManager, 'addComponent'); this.toolbox.init(); - assert.isDefined(this.toolbox.flyout_); + assert.isDefined(this.toolbox.getFlyout()); }); }); @@ -239,30 +239,30 @@ suite('Toolbox', function () { sinon.assert.called(preventDefaultEvent); } - test('Down button is pushed -> Should call selectNext_', function () { - testCorrectFunctionCalled(this.toolbox, 'ArrowDown', 'selectNext_', true); + test('Down button is pushed -> Should call selectNext', function () { + testCorrectFunctionCalled(this.toolbox, 'ArrowDown', 'selectNext', true); }); - test('Up button is pushed -> Should call selectPrevious_', function () { + test('Up button is pushed -> Should call selectPrevious', function () { testCorrectFunctionCalled( this.toolbox, 'ArrowUp', - 'selectPrevious_', + 'selectPrevious', true, ); }); - test('Left button is pushed -> Should call selectParent_', function () { + test('Left button is pushed -> Should call selectParent', function () { testCorrectFunctionCalled( this.toolbox, 'ArrowLeft', - 'selectParent_', + 'selectParent', true, ); }); - test('Right button is pushed -> Should call selectChild_', function () { + test('Right button is pushed -> Should call selectChild', function () { testCorrectFunctionCalled( this.toolbox, 'ArrowRight', - 'selectChild_', + 'selectChild', true, ); }); @@ -295,21 +295,21 @@ suite('Toolbox', function () { this.toolbox.dispose(); }); - suite('selectChild_', function () { + suite('selectChild', function () { test('No item is selected -> Should not handle event', function () { this.toolbox.selectedItem_ = null; - const handled = this.toolbox.selectChild_(); + const handled = this.toolbox.selectChild(); assert.isFalse(handled); }); test('Selected item is not collapsible -> Should not handle event', function () { this.toolbox.selectedItem_ = getNonCollapsibleItem(this.toolbox); - const handled = this.toolbox.selectChild_(); + const handled = this.toolbox.selectChild(); assert.isFalse(handled); }); test('Selected item is collapsible -> Should expand', function () { const collapsibleItem = getCollapsibleItem(this.toolbox); this.toolbox.selectedItem_ = collapsibleItem; - const handled = this.toolbox.selectChild_(); + const handled = this.toolbox.selectChild(); assert.isTrue(handled); assert.isTrue(collapsibleItem.isExpanded()); assert.equal(this.toolbox.selectedItem_, collapsibleItem); @@ -318,25 +318,25 @@ suite('Toolbox', function () { test('Selected item is expanded -> Should select child', function () { const collapsibleItem = getCollapsibleItem(this.toolbox); collapsibleItem.expanded_ = true; - const selectNextStub = sinon.stub(this.toolbox, 'selectNext_'); + const selectNextStub = sinon.stub(this.toolbox, 'selectNext'); this.toolbox.selectedItem_ = collapsibleItem; - const handled = this.toolbox.selectChild_(); + const handled = this.toolbox.selectChild(); assert.isTrue(handled); sinon.assert.called(selectNextStub); }); }); - suite('selectParent_', function () { + suite('selectParent', function () { test('No item selected -> Should not handle event', function () { this.toolbox.selectedItem_ = null; - const handled = this.toolbox.selectParent_(); + const handled = this.toolbox.selectParent(); assert.isFalse(handled); }); test('Selected item is expanded -> Should collapse', function () { const collapsibleItem = getCollapsibleItem(this.toolbox); collapsibleItem.expanded_ = true; this.toolbox.selectedItem_ = collapsibleItem; - const handled = this.toolbox.selectParent_(); + const handled = this.toolbox.selectParent(); assert.isTrue(handled); assert.isFalse(collapsibleItem.isExpanded()); assert.equal(this.toolbox.selectedItem_, collapsibleItem); @@ -344,29 +344,29 @@ suite('Toolbox', function () { test('Selected item is not expanded -> Should get parent', function () { const childItem = getChildItem(this.toolbox); this.toolbox.selectedItem_ = childItem; - const handled = this.toolbox.selectParent_(); + const handled = this.toolbox.selectParent(); assert.isTrue(handled); assert.equal(this.toolbox.selectedItem_, childItem.getParent()); }); }); - suite('selectNext_', function () { + suite('selectNext', function () { test('No item is selected -> Should not handle event', function () { this.toolbox.selectedItem_ = null; - const handled = this.toolbox.selectNext_(); + const handled = this.toolbox.selectNext(); assert.isFalse(handled); }); test('Next item is selectable -> Should select next item', function () { const item = this.toolbox.contents_[0]; this.toolbox.selectedItem_ = item; - const handled = this.toolbox.selectNext_(); + const handled = this.toolbox.selectNext(); assert.isTrue(handled); assert.equal(this.toolbox.selectedItem_, this.toolbox.contents_[1]); }); test('Selected item is last item -> Should not handle event', function () { const item = this.toolbox.contents_[this.toolbox.contents_.length - 1]; this.toolbox.selectedItem_ = item; - const handled = this.toolbox.selectNext_(); + const handled = this.toolbox.selectNext(); assert.isFalse(handled); assert.equal(this.toolbox.selectedItem_, item); }); @@ -375,7 +375,7 @@ suite('Toolbox', function () { const childItem = item.flyoutItems_[0]; item.expanded_ = false; this.toolbox.selectedItem_ = item; - const handled = this.toolbox.selectNext_(); + const handled = this.toolbox.selectNext(); assert.isTrue(handled); assert.notEqual(this.toolbox.selectedItem_, childItem); }); @@ -384,13 +384,13 @@ suite('Toolbox', function () { suite('selectPrevious', function () { test('No item is selected -> Should not handle event', function () { this.toolbox.selectedItem_ = null; - const handled = this.toolbox.selectPrevious_(); + const handled = this.toolbox.selectPrevious(); assert.isFalse(handled); }); test('Selected item is first item -> Should not handle event', function () { const item = this.toolbox.contents_[0]; this.toolbox.selectedItem_ = item; - const handled = this.toolbox.selectPrevious_(); + const handled = this.toolbox.selectPrevious(); assert.isFalse(handled); assert.equal(this.toolbox.selectedItem_, item); }); @@ -398,7 +398,7 @@ suite('Toolbox', function () { const item = this.toolbox.contents_[1]; const prevItem = this.toolbox.contents_[0]; this.toolbox.selectedItem_ = item; - const handled = this.toolbox.selectPrevious_(); + const handled = this.toolbox.selectPrevious(); assert.isTrue(handled); assert.equal(this.toolbox.selectedItem_, prevItem); }); @@ -409,7 +409,7 @@ suite('Toolbox', function () { // Gets the item after the parent. const item = this.toolbox.contents_[parentIdx + 1]; this.toolbox.selectedItem_ = item; - const handled = this.toolbox.selectPrevious_(); + const handled = this.toolbox.selectPrevious(); assert.isTrue(handled); assert.notEqual(this.toolbox.selectedItem_, childItem); }); @@ -477,7 +477,7 @@ suite('Toolbox', function () { }); function testHideFlyout(toolbox, oldItem, newItem) { - const updateFlyoutStub = sinon.stub(toolbox.flyout_, 'hide'); + const updateFlyoutStub = sinon.stub(toolbox.getFlyout(), 'hide'); toolbox.updateFlyout_(oldItem, newItem); sinon.assert.called(updateFlyoutStub); } @@ -498,9 +498,9 @@ suite('Toolbox', function () { testHideFlyout(this.toolbox, null, newItem); }); test('Select selectable item -> Should open flyout', function () { - const showFlyoutstub = sinon.stub(this.toolbox.flyout_, 'show'); + const showFlyoutstub = sinon.stub(this.toolbox.getFlyout(), 'show'); const scrollToStartFlyout = sinon.stub( - this.toolbox.flyout_, + this.toolbox.getFlyout(), 'scrollToStart', ); const newItem = getNonCollapsibleItem(this.toolbox); @@ -534,14 +534,14 @@ suite('Toolbox', function () { test('HtmlDiv is not created -> Should not resize', function () { const toolbox = this.toolbox; toolbox.HtmlDiv = null; - toolbox.horizontalLayout_ = true; + toolbox.horizontalLayout = true; toolbox.position(); assert.equal(toolbox.height_, 0); }); test('Horizontal toolbox at top -> Should anchor horizontal toolbox to top', function () { const toolbox = this.toolbox; toolbox.toolboxPosition = Blockly.utils.toolbox.Position.TOP; - toolbox.horizontalLayout_ = true; + toolbox.horizontalLayout = true; toolbox.position(); checkHorizontalToolbox(toolbox); assert.equal(toolbox.HtmlDiv.style.top, '0px', 'Check top'); @@ -549,7 +549,7 @@ suite('Toolbox', function () { test('Horizontal toolbox at bottom -> Should anchor horizontal toolbox to bottom', function () { const toolbox = this.toolbox; toolbox.toolboxPosition = Blockly.utils.toolbox.Position.BOTTOM; - toolbox.horizontalLayout_ = true; + toolbox.horizontalLayout = true; toolbox.position(); checkHorizontalToolbox(toolbox); assert.equal(toolbox.HtmlDiv.style.bottom, '0px', 'Check bottom'); @@ -557,7 +557,7 @@ suite('Toolbox', function () { test('Vertical toolbox at right -> Should anchor to right', function () { const toolbox = this.toolbox; toolbox.toolboxPosition = Blockly.utils.toolbox.Position.RIGHT; - toolbox.horizontalLayout_ = false; + toolbox.horizontalLayout = false; toolbox.position(); assert.equal(toolbox.HtmlDiv.style.right, '0px', 'Check right'); checkVerticalToolbox(toolbox); @@ -565,7 +565,7 @@ suite('Toolbox', function () { test('Vertical toolbox at left -> Should anchor to left', function () { const toolbox = this.toolbox; toolbox.toolboxPosition = Blockly.utils.toolbox.Position.LEFT; - toolbox.horizontalLayout_ = false; + toolbox.horizontalLayout = false; toolbox.position(); assert.equal(toolbox.HtmlDiv.style.left, '0px', 'Check left'); checkVerticalToolbox(toolbox); diff --git a/tests/mocha/variable_model_test.js b/tests/mocha/variable_model_test.js index 207c580de..4ac533b65 100644 --- a/tests/mocha/variable_model_test.js +++ b/tests/mocha/variable_model_test.js @@ -29,7 +29,7 @@ suite('Variable Model', function () { ); assert.equal(variable.name, 'test'); assert.equal(variable.type, 'test_type'); - assert.equal(variable.id_, 'test_id'); + assert.equal(variable.getId(), 'test_id'); }); test('Null type', function () { @@ -61,7 +61,7 @@ suite('Variable Model', function () { ); assert.equal(variable.name, 'test'); assert.equal(variable.type, 'test_type'); - assert.exists(variable.id_); + assert.exists(variable.getId()); }); test('Undefined id', function () { @@ -73,13 +73,13 @@ suite('Variable Model', function () { ); assert.equal(variable.name, 'test'); assert.equal(variable.type, 'test_type'); - assert.exists(variable.id_); + assert.exists(variable.getId()); }); test('Only name provided', function () { const variable = new Blockly.VariableModel(this.workspace, 'test'); assert.equal(variable.name, 'test'); assert.equal(variable.type, ''); - assert.exists(variable.id_); + assert.exists(variable.getId()); }); }); diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js index 75c0625fb..8282e7ac2 100644 --- a/tests/mocha/workspace_svg_test.js +++ b/tests/mocha/workspace_svg_test.js @@ -136,7 +136,7 @@ suite('WorkspaceSvg', function () { sinon .stub(Blockly.utils.toolbox.TEST_ONLY, 'hasCategoriesInternal') .returns(true); - this.workspace.toolbox_ = null; + this.workspace.toolbox = null; assert.throws( function () { this.workspace.updateToolbox({'contents': []}); From 5870c66cf07ff3caf12bddfe50d294602856bb5a Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 3 Dec 2024 12:40:48 -0800 Subject: [PATCH 05/13] chore: Migrate ESLint configuration file to new flat format. (#8675) * chore: rename .eslintrc.js to eslint.config.js * chore: Rename eslint.config.js to eslint.config.mjs. * refactor: Migrate ESLint config to new flat format. * chore: Remove old per-directory and global ignore ESLint config files. * fix: Allowlist JSDoc tag aliases. * fix: Don't require @license in tests/*. * fix: Add NodeJS globals to several files that run under Node. * chore: Remove now-unneeded ESLint directives in core. * chore: Remove invalid/unneeded ESLint directives. * fix: Fix invalid use of `await` outside of an `async` function. * fix: Improve screenshot error message. * fix: Update ESLint config file to not warn on existing violations. * chore: Remove suppressions of rules that weren't triggering. * chore: Fix package-lock.json. --- .eslintignore | 28 - .eslintrc.js | 189 ----- core/interfaces/i_serializer.ts | 1 - core/renderers/geras/constants.ts | 4 - core/renderers/zelos/constants.ts | 2 - core/serialization/blocks.ts | 4 - core/serialization/variables.ts | 1 - core/variables.ts | 1 - core/workspace_svg.ts | 2 - eslint.config.mjs | 308 ++++++++ package-lock.json | 739 ++++++++++---------- package.json | 11 +- scripts/helpers.js | 4 +- tests/.eslintrc.json | 10 - tests/browser/.eslintrc.json | 29 - tests/migration/validate-renamings.mjs | 61 +- tests/mocha/.eslintrc.json | 21 - tests/mocha/serializer_test.js | 4 - tests/mocha/test_helpers/code_generation.js | 1 - tests/mocha/workspace_test.js | 1 - tests/node/.eslintrc.json | 12 - tests/playgrounds/screenshot.js | 2 +- 22 files changed, 716 insertions(+), 719 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs delete mode 100644 tests/.eslintrc.json delete mode 100644 tests/browser/.eslintrc.json delete mode 100644 tests/mocha/.eslintrc.json delete mode 100644 tests/node/.eslintrc.json diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 1430463fe..000000000 --- a/.eslintignore +++ /dev/null @@ -1,28 +0,0 @@ -# Build Artifacts -/msg/* -/build/* -/dist/* -/typings/* -/docs/* - -# Tests other than mocha unit tests -/tests/blocks/* -/tests/themes/* -/tests/compile/* -/tests/jsunit/* -/tests/generators/* -/tests/mocha/webdriver.js -/tests/screenshot/* -/tests/test_runner.js -/tests/workspace_svg/* - -# Demos, scripts, misc -/node_modules/* -/generators/* -/demos/* -/appengine/* -/externs/* -/closure/* -/scripts/gulpfiles/* -CHANGELOG.md -PULL_REQUEST_TEMPLATE.md \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5b539133b..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,189 +0,0 @@ -const rules = { - 'no-unused-vars': [ - 'error', - { - 'args': 'after-used', - // Ignore vars starting with an underscore. - 'varsIgnorePattern': '^_', - // Ignore arguments starting with an underscore. - 'argsIgnorePattern': '^_', - }, - ], - // Blockly uses for exporting symbols. no-self-assign added in eslint 5. - 'no-self-assign': ['off'], - // Blockly uses single quotes except for JSON blobs, which must use double - // quotes. - 'quotes': ['off'], - // Blockly uses 'use strict' in files. - 'strict': ['off'], - // Closure style allows redeclarations. - 'no-redeclare': ['off'], - 'valid-jsdoc': ['error'], - 'no-console': ['off'], - 'spaced-comment': [ - 'error', - 'always', - { - 'block': { - 'balanced': true, - }, - 'exceptions': ['*'], - }, - ], - // Blockly uses prefixes for optional arguments and test-only functions. - 'camelcase': [ - 'error', - { - 'properties': 'never', - 'allow': ['^opt_', '^_opt_', '^testOnly_'], - }, - ], - // Blockly uses capital letters for some non-constructor namespaces. - // Keep them for legacy reasons. - 'new-cap': ['off'], - // Blockly uses objects as maps, but uses Object.create(null) to - // instantiate them. - 'guard-for-in': ['off'], - 'prefer-spread': ['off'], -}; - -/** - * Build shared settings for TS linting and add in the config differences. - * @return {Object} The override TS linting for given files and a given - * tsconfig. - */ -function buildTSOverride({files, tsconfig}) { - return { - 'files': files, - 'plugins': ['@typescript-eslint/eslint-plugin', 'jsdoc'], - 'settings': { - 'jsdoc': { - 'mode': 'typescript', - }, - }, - 'parser': '@typescript-eslint/parser', - 'parserOptions': { - 'project': tsconfig, - 'tsconfigRootDir': '.', - 'ecmaVersion': 2020, - 'sourceType': 'module', - }, - 'extends': [ - 'plugin:@typescript-eslint/recommended', - 'plugin:jsdoc/recommended', - 'prettier', // Extend again so that these rules are applied last - ], - 'rules': { - // TS rules - // Blockly uses namespaces to do declaration merging in some cases. - '@typescript-eslint/no-namespace': ['off'], - // Use the updated TypeScript-specific rule. - 'no-invalid-this': ['off'], - '@typescript-eslint/no-invalid-this': ['error'], - // Needs decision. 601 problems. - '@typescript-eslint/no-non-null-assertion': ['off'], - // Use TS-specific rule. - 'no-unused-vars': ['off'], - '@typescript-eslint/no-unused-vars': [ - 'error', - { - 'argsIgnorePattern': '^_', - 'varsIgnorePattern': '^_', - }, - ], - // Temporarily disable. 23 problems. - '@typescript-eslint/no-explicit-any': ['off'], - // Temporarily disable. 128 problems. - 'require-jsdoc': ['off'], - // Temporarily disable. 55 problems. - '@typescript-eslint/ban-types': ['off'], - // Temporarily disable. 33 problems. - '@typescript-eslint/no-empty-function': ['off'], - // Temporarily disable. 3 problems. - '@typescript-eslint/no-empty-interface': ['off'], - // We use this pattern extensively for block (e.g. controls_if) interfaces. - '@typescript-eslint/no-empty-object-type': ['off'], - - // TsDoc rules (using JsDoc plugin) - // Disable built-in jsdoc verifier. - 'valid-jsdoc': ['off'], - // Don't require types in params and returns docs. - 'jsdoc/require-param-type': ['off'], - 'jsdoc/require-returns-type': ['off'], - // params and returns docs are optional. - 'jsdoc/require-param-description': ['off'], - 'jsdoc/require-returns': ['off'], - // Disable for now (breaks on `this` which is not really a param). - 'jsdoc/require-param': ['off'], - // Don't auto-add missing jsdoc. Only required on exported items. - 'jsdoc/require-jsdoc': [ - 'warn', - { - 'enableFixer': false, - 'publicOnly': true, - }, - ], - 'jsdoc/check-tag-names': [ - 'error', - { - 'definedTags': [ - 'sealed', - 'typeParam', - 'remarks', - 'define', - 'nocollapse', - 'suppress', - ], - }, - ], - // Re-enable after Closure is removed. There shouldn't even be - // types in the TsDoc. - // These are "types" because of Closure's @suppress {warningName} - 'jsdoc/no-undefined-types': ['off'], - 'jsdoc/valid-types': ['off'], - // Disabled due to not handling `this`. If re-enabled, - // checkDestructured option - // should be left as false. - 'jsdoc/check-param-names': ['off', {'checkDestructured': false}], - // Allow any text in the license tag. Other checks are not relevant. - 'jsdoc/check-values': ['off'], - // Ensure there is a blank line between the body and any @tags, - // as required by the tsdoc spec (see #6353). - 'jsdoc/tag-lines': ['error', 'any', {'startLines': 1}], - }, - }; -} - -// NOTE: When this output is put directly in `module.exports`, the formatter -// does not align with the linter. -const eslintJSON = { - 'rules': rules, - 'env': { - 'es2020': true, - 'browser': true, - }, - 'globals': { - 'goog': true, - 'exports': true, - }, - 'extends': ['eslint:recommended', 'google', 'prettier'], - // TypeScript-specific config. Uses above rules plus these. - 'overrides': [ - buildTSOverride({ - files: ['./**/*.ts', './**/*.tsx'], - tsconfig: './tsconfig.json', - }), - buildTSOverride({ - files: ['./tests/typescript/**/*.ts', './tests/typescript/**/*.tsx'], - tsconfig: './tests/typescript/tsconfig.json', - }), - { - 'files': ['./.eslintrc.js'], - 'env': { - 'node': true, - }, - }, - ], -}; - -module.exports = eslintJSON; diff --git a/core/interfaces/i_serializer.ts b/core/interfaces/i_serializer.ts index 0e8302f39..f5fbb67d1 100644 --- a/core/interfaces/i_serializer.ts +++ b/core/interfaces/i_serializer.ts @@ -30,7 +30,6 @@ export interface ISerializer { * state to record. */ save(workspace: Workspace): object | null; - /* eslint-enable valid-jsdoc */ /** * Loads the state of the plugin or system. diff --git a/core/renderers/geras/constants.ts b/core/renderers/geras/constants.ts index fc0b7ae79..6d0c3dfbf 100644 --- a/core/renderers/geras/constants.ts +++ b/core/renderers/geras/constants.ts @@ -31,16 +31,12 @@ export class ConstantProvider extends BaseConstantProvider { override getCSS_(selector: string) { return super.getCSS_(selector).concat([ - /* eslint-disable indent */ - /* clang-format off */ // Insertion marker. `${selector} .blocklyInsertionMarker>.blocklyPathLight,`, `${selector} .blocklyInsertionMarker>.blocklyPathDark {`, `fill-opacity: ${this.INSERTION_MARKER_OPACITY};`, `stroke: none;`, '}', - /* clang-format on */ - /* eslint-enable indent */ ]); } } diff --git a/core/renderers/zelos/constants.ts b/core/renderers/zelos/constants.ts index 66ba6c958..74df72aeb 100644 --- a/core/renderers/zelos/constants.ts +++ b/core/renderers/zelos/constants.ts @@ -786,7 +786,6 @@ export class ConstantProvider extends BaseConstantProvider { override getCSS_(selector: string) { return [ - /* eslint-disable indent */ // Text. `${selector} .blocklyText,`, `${selector} .blocklyFlyoutLabelText {`, @@ -871,4 +870,3 @@ export class ConstantProvider extends BaseConstantProvider { ]; } } -/* eslint-enable indent */ diff --git a/core/serialization/blocks.ts b/core/serialization/blocks.ts index b693ff569..b90262240 100644 --- a/core/serialization/blocks.ts +++ b/core/serialization/blocks.ts @@ -32,9 +32,6 @@ import { import * as priorities from './priorities.js'; import * as serializationRegistry from './registry.js'; -// TODO(#5160): Remove this once lint is fixed. -/* eslint-disable no-use-before-define */ - /** * Represents the state of a connection. */ @@ -795,7 +792,6 @@ const saveBlock = save; export class BlockSerializer implements ISerializer { priority: number; - /* eslint-disable-next-line require-jsdoc */ constructor() { /** The priority for deserializing blocks. */ this.priority = priorities.BLOCKS; diff --git a/core/serialization/variables.ts b/core/serialization/variables.ts index b714401eb..e4fc7fbaa 100644 --- a/core/serialization/variables.ts +++ b/core/serialization/variables.ts @@ -26,7 +26,6 @@ export interface State { export class VariableSerializer implements ISerializer { priority: number; - /* eslint-disable-next-line require-jsdoc */ constructor() { /** The priority for deserializing variables. */ this.priority = priorities.VARIABLES; diff --git a/core/variables.ts b/core/variables.ts index b69893a9f..491b4c1b7 100644 --- a/core/variables.ts +++ b/core/variables.ts @@ -202,7 +202,6 @@ export function generateUniqueNameFromOptions( let letterIndex = letters.indexOf(startChar); let potName = startChar; - // eslint-disable-next-line no-constant-condition while (true) { let inUse = false; for (let i = 0; i < usedNames.length; i++) { diff --git a/core/workspace_svg.ts b/core/workspace_svg.ts index faebcda97..6acd31c9c 100644 --- a/core/workspace_svg.ts +++ b/core/workspace_svg.ts @@ -1077,14 +1077,12 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg { * @internal */ updateScreenCalculationsIfScrolled() { - /* eslint-disable indent */ const currScroll = svgMath.getDocumentScroll(); if (!Coordinate.equals(this.lastRecordedPageScroll, currScroll)) { this.lastRecordedPageScroll = currScroll; this.updateScreenCalculations(); } } - /* eslint-enable indent */ /** * @returns The layer manager for this workspace. diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..68f25133f --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,308 @@ +import eslint from '@eslint/js'; +import googleStyle from 'eslint-config-google'; +import jsdoc from 'eslint-plugin-jsdoc'; +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; + +// These rules are no longer supported, but the Google style package we depend +// on hasn't been updated in years to remove them, even though they have been +// removed from the repo. Manually delete them here to avoid breaking linting. +delete googleStyle.rules['valid-jsdoc']; +delete googleStyle.rules['require-jsdoc']; + +const rules = { + 'spaced-comment': [ + 'error', + 'always', + { + 'block': { + 'balanced': true, + }, + 'exceptions': ['*'], + }, + ], + // Blockly uses prefixes for optional arguments and test-only functions. + 'camelcase': [ + 'error', + { + 'properties': 'never', + 'allow': ['^opt_', '^_opt_', '^testOnly_'], + }, + ], + // Blockly uses capital letters for some non-constructor namespaces. + // Keep them for legacy reasons. + 'new-cap': ['off'], + // Blockly uses objects as maps, but uses Object.create(null) to + // instantiate them. + 'guard-for-in': ['off'], +}; + +/** + * Build shared settings for TS linting and add in the config differences. + * @param {object} root0 A configuration options struct. + * @param {!Array} root0.files List of file globs to apply rules to. + * @param {string} root0.tsconfig Path to the tsconfig.json file to use. + * @returns {object} The override TS linting for given files and a given + * tsconfig. + */ +function buildTSOverride({files, tsconfig}) { + return { + files: files, + plugins: { + '@typescript-eslint': tseslint.plugin, + jsdoc, + }, + languageOptions: { + parser: tseslint.parser, + 'ecmaVersion': 2020, + 'sourceType': 'module', + parserOptions: { + 'project': tsconfig, + 'tsconfigRootDir': '.', + }, + globals: { + ...globals.browser, + }, + }, + extends: [ + ...tseslint.configs.recommended, + jsdoc.configs['flat/recommended-typescript'], + eslintPluginPrettierRecommended, + ], + rules: { + // TS rules + // Blockly uses namespaces to do declaration merging in some cases. + '@typescript-eslint/no-namespace': ['off'], + // Use the updated TypeScript-specific rule. + 'no-invalid-this': ['off'], + '@typescript-eslint/no-invalid-this': ['error'], + '@typescript-eslint/no-unused-vars': [ + 'error', + { + 'argsIgnorePattern': '^_', + 'varsIgnorePattern': '^_', + }, + ], + // Temporarily disable. 23 problems. + '@typescript-eslint/no-explicit-any': ['off'], + // We use this pattern extensively for block (e.g. controls_if) interfaces. + '@typescript-eslint/no-empty-object-type': ['off'], + + // params and returns docs are optional. + 'jsdoc/require-param-description': ['off'], + 'jsdoc/require-returns': ['off'], + // Disable for now (breaks on `this` which is not really a param). + 'jsdoc/require-param': ['off'], + // Don't auto-add missing jsdoc. Only required on exported items. + 'jsdoc/require-jsdoc': [ + 'warn', + { + 'enableFixer': false, + 'publicOnly': true, + }, + ], + 'jsdoc/check-tag-names': [ + 'error', + { + 'definedTags': [ + 'sealed', + 'typeParam', + 'remarks', + 'define', + 'nocollapse', + ], + }, + ], + // Disabled due to not handling `this`. If re-enabled, + // checkDestructured option + // should be left as false. + 'jsdoc/check-param-names': ['off', {'checkDestructured': false}], + // Allow any text in the license tag. Other checks are not relevant. + 'jsdoc/check-values': ['off'], + // Ensure there is a blank line between the body and any @tags, + // as required by the tsdoc spec (see #6353). + 'jsdoc/tag-lines': ['error', 'any', {'startLines': 1}], + }, + }; +} + +export default [ + { + // Note: there should be no other properties in this object + ignores: [ + // Build artifacts + 'msg/*', + 'build/*', + 'dist/*', + 'typings/*', + 'docs/*', + // Tests other than mocha unit tests + 'tests/blocks/*', + 'tests/themes/*', + 'tests/compile/*', + 'tests/jsunit/*', + 'tests/generators/*', + 'tests/mocha/webdriver.js', + 'tests/screenshot/*', + 'tests/test_runner.js', + 'tests/workspace_svg/*', + // Demos, scripts, misc + 'node_modules/*', + 'generators/*', + 'demos/*', + 'appengine/*', + 'externs/*', + 'closure/*', + 'scripts/gulpfiles/*', + 'CHANGELOG.md', + 'PULL_REQUEST_TEMPLATE.md', + ], + }, + eslint.configs.recommended, + jsdoc.configs['flat/recommended'], + googleStyle, + { + languageOptions: { + ecmaVersion: 2020, + sourceType: 'module', + }, + settings: { + // Allowlist some JSDoc tag aliases we use. + 'jsdoc': { + 'tagNamePreference': { + 'return': 'return', + 'fileoverview': 'fileoverview', + 'extends': 'extends', + 'constructor': 'constructor', + }, + }, + }, + rules, + }, + { + files: [ + 'eslint.config.mjs', + '.prettierrc.js', + 'gulpfile.js', + 'scripts/helpers.js', + 'tests/mocha/.mocharc.js', + 'tests/migration/validate-renamings.mjs', + ], + languageOptions: { + globals: { + ...globals.node, + }, + }, + rules: { + 'jsdoc/check-values': ['off'], + }, + }, + { + files: ['tests/**'], + languageOptions: { + globals: { + 'Blockly': true, + 'dartGenerator': true, + 'javascriptGenerator': true, + 'luaGenerator': true, + 'phpGenerator': true, + 'pythonGenerator': true, + }, + }, + rules: { + 'jsdoc/check-values': ['off'], + 'jsdoc/require-returns': ['off'], + 'jsdoc/no-undefined-types': ['off'], + 'jsdoc/valid-types': ['off'], + 'jsdoc/check-types': ['off'], + 'jsdoc/check-tag-names': ['warn', {'definedTags': ['record']}], + 'jsdoc/tag-lines': ['off'], + 'jsdoc/no-defaults': ['off'], + }, + }, + { + files: ['tests/browser/**'], + languageOptions: { + sourceType: 'module', + globals: { + 'chai': false, + 'sinon': false, + ...globals.mocha, + ...globals.browser, + ...globals.node, + }, + }, + rules: { + // Allow uncommented helper functions in tests. + 'jsdoc/require-jsdoc': ['off'], + 'jsdoc/require-returns-type': ['off'], + 'jsdoc/require-param-type': ['off'], + 'no-invalid-this': ['off'], + }, + }, + { + files: ['tests/mocha/**'], + languageOptions: { + sourceType: 'module', + globals: { + 'chai': false, + 'sinon': false, + ...globals.mocha, + ...globals.browser, + }, + }, + rules: { + 'no-unused-vars': ['off'], + // Allow uncommented helper functions in tests. + 'jsdoc/require-jsdoc': ['off'], + 'prefer-rest-params': ['off'], + 'no-invalid-this': ['off'], + }, + }, + { + files: ['tests/node/**'], + languageOptions: { + globals: { + 'console': true, + 'require': true, + ...globals.mocha, + ...globals.node, + }, + }, + }, + { + files: ['tests/playgrounds/**', 'tests/scripts/**'], + languageOptions: { + globals: { + ...globals.browser, + }, + }, + }, + { + files: ['scripts/**'], + languageOptions: { + globals: { + ...globals.browser, + }, + }, + rules: { + 'jsdoc/check-values': ['off'], + 'jsdoc/require-returns': ['off'], + 'jsdoc/tag-lines': ['off'], + }, + }, + ...tseslint.config( + buildTSOverride({ + files: ['**/*.ts', '**/*.tsx'], + tsconfig: './tsconfig.json', + }), + buildTSOverride({ + files: ['tests/typescript/**/*.ts', 'tests/typescript/**/*.tsx'], + tsconfig: './tests/typescript/tsconfig.json', + }), + ), + // Per the docs, this should be at the end because it disables rules that + // conflict with Prettier. + eslintPluginPrettierRecommended, +]; diff --git a/package-lock.json b/package-lock.json index 971bc80c9..ff83cb6d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,16 +20,16 @@ "@hyperjump/json-schema": "^1.5.0", "@microsoft/api-documenter": "^7.22.4", "@microsoft/api-extractor": "^7.29.5", - "@typescript-eslint/eslint-plugin": "^8.1.0", - "@typescript-eslint/parser": "^8.1.0", "async-done": "^2.0.0", "chai": "^5.1.1", "concurrently": "^9.0.1", - "eslint": "^8.4.1", + "eslint": "^9.15.0", "eslint-config-google": "^0.14.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-jsdoc": "^50.4.3", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^50.5.0", + "eslint-plugin-prettier": "^5.2.1", "glob": "^10.3.4", + "globals": "^15.12.0", "google-closure-compiler": "^20240317.0.0", "gulp": "^5.0.0", "gulp-concat": "^2.6.1", @@ -52,6 +52,7 @@ "readline-sync": "^1.4.10", "rimraf": "^5.0.0", "typescript": "^5.3.3", + "typescript-eslint": "^8.16.0", "webdriverio": "^9.0.7", "yargs": "^17.2.1" }, @@ -264,24 +265,47 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.1.tgz", - "integrity": "sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, + "node_modules/@eslint/config-array": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", + "dev": true, + "dependencies": { + "@eslint/object-schema": "^2.1.4", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", + "espree": "^10.0.1", + "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -289,19 +313,52 @@ "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" } }, - "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.15.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.15.0.tgz", + "integrity": "sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", + "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", + "dev": true, + "dependencies": { + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@gulp-sourcemaps/identity-map": { @@ -422,18 +479,39 @@ "node": ">=10.13.0" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" }, "engines": { - "node": ">=10.10.0" + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, "node_modules/@humanwhocodes/module-importer": { @@ -449,11 +527,18 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", - "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", - "dev": true + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } }, "node_modules/@hyperjump/browser": { "version": "1.1.6", @@ -1065,12 +1150,24 @@ "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", "dev": true }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, "node_modules/@types/expect": { "version": "1.20.4", "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", "integrity": "sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==", "dev": true }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/node": { "version": "20.16.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.3.tgz", @@ -1122,16 +1219,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.14.0.tgz", - "integrity": "sha512-tqp8H7UWFaZj0yNO6bycd5YjMwxa6wIHOLZvWPkidwbgLCsBMetQoGj7DPuAlWa2yGO3H48xmPwjhsSPPCGU5w==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.16.0.tgz", + "integrity": "sha512-5YTHKV8MYlyMI6BaEG7crQ9BhSc8RxzshOReKwZwRWN0+XvvTOm+L/UYLCYxFpfwYuAAqhxiq4yae0CMFwbL7Q==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/type-utils": "8.14.0", - "@typescript-eslint/utils": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/scope-manager": "8.16.0", + "@typescript-eslint/type-utils": "8.16.0", + "@typescript-eslint/utils": "8.16.0", + "@typescript-eslint/visitor-keys": "8.16.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1155,15 +1252,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.15.0.tgz", - "integrity": "sha512-7n59qFpghG4uazrF9qtGKBZXn7Oz4sOMm8dwNWDQY96Xlm2oX67eipqcblDj+oY1lLCbf1oltMZFpUso66Kl1A==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.16.0.tgz", + "integrity": "sha512-D7DbgGFtsqIPIFMPJwCad9Gfi/hC0PWErRRHFnaCWoEDYi5tQUDiJCTmGUbBiLzjqAck4KcXt9Ayj0CNlIrF+w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.15.0", - "@typescript-eslint/types": "8.15.0", - "@typescript-eslint/typescript-estree": "8.15.0", - "@typescript-eslint/visitor-keys": "8.15.0", + "@typescript-eslint/scope-manager": "8.16.0", + "@typescript-eslint/types": "8.16.0", + "@typescript-eslint/typescript-estree": "8.16.0", + "@typescript-eslint/visitor-keys": "8.16.0", "debug": "^4.3.4" }, "engines": { @@ -1182,137 +1279,14 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.15.0.tgz", - "integrity": "sha512-QRGy8ADi4J7ii95xz4UoiymmmMd/zuy9azCaamnZ3FM8T5fZcex8UfJcjkiEZjJSztKfEBe3dZ5T/5RHAmw2mA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "8.15.0", - "@typescript-eslint/visitor-keys": "8.15.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.15.0.tgz", - "integrity": "sha512-n3Gt8Y/KyJNe0S3yDCD2RVKrHBC4gTUcLTebVBXacPy091E6tNspFLKRXlk3hwT4G55nfr1n2AdFqi/XMxzmPQ==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.15.0.tgz", - "integrity": "sha512-1eMp2JgNec/niZsR7ioFBlsh/Fk0oJbhaqO0jRyQBMgkz7RrFfkqF9lYYmBoGBaSiLnu8TAPQTwoTUiSTUW9dg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "8.15.0", - "@typescript-eslint/visitor-keys": "8.15.0", - "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.15.0.tgz", - "integrity": "sha512-h8vYOulWec9LhpwfAdZf2bjr8xIp0KNKnpgqSz0qqYYKAW/QZKw3ktRndbiAtUz4acH4QLQavwZBYCc0wulA/Q==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "8.15.0", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.14.0.tgz", - "integrity": "sha512-aBbBrnW9ARIDn92Zbo7rguLnqQ/pOrUguVpbUwzOhkFg2npFDwTgPGqFqE0H5feXcOoJOfX3SxlJaKEVtq54dw==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.16.0.tgz", + "integrity": "sha512-mwsZWubQvBki2t5565uxF0EYvG+FwdFb8bMtDuGQLdCCnGPrDEDvm1gtfynuKlnpzeBRqdFCkMf9jg1fnAK8sg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0" + "@typescript-eslint/types": "8.16.0", + "@typescript-eslint/visitor-keys": "8.16.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1323,13 +1297,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.14.0.tgz", - "integrity": "sha512-Xcz9qOtZuGusVOH5Uk07NGs39wrKkf3AxlkK79RBK6aJC1l03CobXjJbwBPSidetAOV+5rEVuiT1VSBUOAsanQ==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.16.0.tgz", + "integrity": "sha512-IqZHGG+g1XCWX9NyqnI/0CX5LL8/18awQqmkZSl2ynn8F76j579dByc0jhfVSnSnhf7zv76mKBQv9HQFKvDCgg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "8.14.0", - "@typescript-eslint/utils": "8.14.0", + "@typescript-eslint/typescript-estree": "8.16.0", + "@typescript-eslint/utils": "8.16.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1340,6 +1314,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -1347,9 +1324,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.14.0.tgz", - "integrity": "sha512-yjeB9fnO/opvLJFAsPNYlKPnEM8+z4og09Pk504dkqonT02AyL5Z9SSqlE0XqezS93v6CXn49VHvB2G7XSsl0g==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.16.0.tgz", + "integrity": "sha512-NzrHj6thBAOSE4d9bsuRNMvk+BvaQvmY4dDglgkgGC0EW/tB3Kelnp3tAKH87GEwzoxgeQn9fNGRyFJM/xd+GQ==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1360,13 +1337,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.14.0.tgz", - "integrity": "sha512-OPXPLYKGZi9XS/49rdaCbR5j/S14HazviBlUQFvSKz3npr3NikF+mrgK7CFVur6XEt95DZp/cmke9d5i3vtVnQ==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.16.0.tgz", + "integrity": "sha512-E2+9IzzXMc1iaBy9zmo+UYvluE3TW7bCGWSF41hVWUE01o8nzr1rvOQYSxelxr6StUvRcTMe633eY8mXASMaNw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/types": "8.16.0", + "@typescript-eslint/visitor-keys": "8.16.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1424,15 +1401,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.14.0.tgz", - "integrity": "sha512-OGqj6uB8THhrHj0Fk27DcHPojW7zKwKkPmHXHvQ58pLYp4hy8CSUdTKykKeh+5vFqTTVmjz0zCOOPKRovdsgHA==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.16.0.tgz", + "integrity": "sha512-C1zRy/mOL8Pj157GiX4kaw7iyRLKfJXBR3L82hk5kS/GyHcOFmy4YUq/zfZti72I9wnuQtA/+xzft4wCC8PJdA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.14.0", - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/typescript-estree": "8.14.0" + "@typescript-eslint/scope-manager": "8.16.0", + "@typescript-eslint/types": "8.16.0", + "@typescript-eslint/typescript-estree": "8.16.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1443,16 +1420,21 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.14.0.tgz", - "integrity": "sha512-vG0XZo8AdTH9OE6VFRwAZldNc7qtJ/6NLGWak+BtENuEUXGZgFpihILPiBvKXvJ2nFu27XNGC6rKiwuaoMbYzQ==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.16.0.tgz", + "integrity": "sha512-pq19gbaMOmFE3CbL0ZB8J8BFCo2ckfHBfaIsaOZgBIF4EoISJIdLX5xRhd0FGB0LlHReNRuzoJoMGpTjq8F2CQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "8.14.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.16.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1462,11 +1444,17 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", - "dev": true + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } }, "node_modules/@wdio/config": { "version": "9.0.8", @@ -2948,9 +2936,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", @@ -3236,18 +3224,6 @@ "node": ">=0.3.1" } }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -3577,58 +3553,62 @@ } }, "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "version": "9.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.15.0.tgz", + "integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.15.0", + "@eslint/plugin-kit": "^0.2.3", + "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.5", "debug": "^4.3.2", - "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", + "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, "node_modules/eslint-config-google": { @@ -3656,9 +3636,9 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "50.4.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.4.3.tgz", - "integrity": "sha512-uWtwFxGRv6B8sU63HZM5dAGDhgsatb+LONwmILZJhdRALLOkCX2HFZhdL/Kw2ls8SQMAVEfK+LmnEfxInRN8HA==", + "version": "50.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.5.0.tgz", + "integrity": "sha512-xTkshfZrUbiSHXBwZ/9d5ulZ2OcHXxSvm/NPo494H/hadLRJwOq5PMV0EUpMqsb9V+kQo+9BAgi6Z7aJtdBp2A==", "dev": true, "dependencies": { "@es-joy/jsdoccomment": "~0.49.0", @@ -3680,35 +3660,6 @@ "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" } }, - "node_modules/eslint-plugin-jsdoc/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-plugin-jsdoc/node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", - "dev": true, - "dependencies": { - "acorn": "^8.14.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, "node_modules/eslint-plugin-jsdoc/node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -3731,17 +3682,47 @@ "spdx-license-ids": "^3.0.0" } }, + "node_modules/eslint-plugin-prettier": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", + "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.9.1" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3759,6 +3740,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/eslint/node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -3772,17 +3765,29 @@ } }, "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", "dev": true, "dependencies": { - "acorn": "^8.9.0", + "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" + "eslint-visitor-keys": "^4.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { "url": "https://opencollective.com/eslint" @@ -3964,6 +3969,12 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, "node_modules/fast-fifo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", @@ -3975,7 +3986,6 @@ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, - "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -4072,15 +4082,15 @@ } }, "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, "dependencies": { - "flat-cache": "^3.0.4" + "flat-cache": "^4.0.0" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=16.0.0" } }, "node_modules/fill-range": { @@ -4170,57 +4180,22 @@ } }, "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" + "flatted": "^3.2.9", + "keyv": "^4.5.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flat-cache/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/flat-cache/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=16" } }, "node_modules/flatted": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", - "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true }, "node_modules/follow-redirects": { @@ -4640,27 +4615,12 @@ } }, "node_modules/globals": { - "version": "13.23.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", - "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", - "dev": true, - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globals/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "version": "15.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.12.0.tgz", + "integrity": "sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ==", "dev": true, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -5599,15 +5559,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/is-plain-object": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", @@ -5878,6 +5829,12 @@ "node": ">=18" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -5983,6 +5940,15 @@ "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", "dev": true }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/klaw-sync": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz", @@ -6290,7 +6256,6 @@ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 8" } @@ -7211,6 +7176,18 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/prettier-plugin-organize-imports": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-4.0.0.tgz", @@ -8237,12 +8214,6 @@ "b4a": "^1.6.4" } }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true - }, "node_modules/textextensions": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-3.3.0.tgz", @@ -8428,6 +8399,32 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.16.0.tgz", + "integrity": "sha512-wDkVmlY6O2do4V+lZd0GtRfbtXbeD0q9WygwXXSJnC1xorE8eqyC2L1tJimqpSeFrOzRlYtWnUp/uzgHQOgfBQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.16.0", + "@typescript-eslint/parser": "8.16.0", + "@typescript-eslint/utils": "8.16.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", diff --git a/package.json b/package.json index 10b5e2ab9..afa6e7d90 100644 --- a/package.json +++ b/package.json @@ -107,16 +107,16 @@ "@hyperjump/json-schema": "^1.5.0", "@microsoft/api-documenter": "^7.22.4", "@microsoft/api-extractor": "^7.29.5", - "@typescript-eslint/eslint-plugin": "^8.1.0", - "@typescript-eslint/parser": "^8.1.0", "async-done": "^2.0.0", "chai": "^5.1.1", "concurrently": "^9.0.1", - "eslint": "^8.4.1", + "eslint": "^9.15.0", "eslint-config-google": "^0.14.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-jsdoc": "^50.4.3", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^50.5.0", + "eslint-plugin-prettier": "^5.2.1", "glob": "^10.3.4", + "globals": "^15.12.0", "google-closure-compiler": "^20240317.0.0", "gulp": "^5.0.0", "gulp-concat": "^2.6.1", @@ -139,6 +139,7 @@ "readline-sync": "^1.4.10", "rimraf": "^5.0.0", "typescript": "^5.3.3", + "typescript-eslint": "^8.16.0", "webdriverio": "^9.0.7", "yargs": "^17.2.1" }, diff --git a/scripts/helpers.js b/scripts/helpers.js index 8150593dd..08a147d3e 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -35,7 +35,7 @@ function posixPath(target) { * @return {string} The value s as a eval-able string literal. */ function quote(str) { - /* eslint-disable no-control-regex, no-multi-spaces */ + /* eslint-disable no-control-regex */ /** Regexp for characters to be escaped in a single-quoted string. */ const singleRE = /[\x00-\x1f\\\u2028\u2029']/g; @@ -63,7 +63,7 @@ function quote(str) { '\u2028': '\\u2028', '\u2029': '\\u2029', }; - /* eslint-enable no-control-regex, no-multi-spaces */ + /* eslint-enable no-control-regex */ return "'" + str.replace(singleRE, (c) => replacements[c]) + "'"; } diff --git a/tests/.eslintrc.json b/tests/.eslintrc.json deleted file mode 100644 index 1d5e1fea2..000000000 --- a/tests/.eslintrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "globals": { - "Blockly": true, - "dartGenerator": true, - "javascriptGenerator": true, - "luaGenerator": true, - "phpGenerator": true, - "pythonGenerator": true - } -} diff --git a/tests/browser/.eslintrc.json b/tests/browser/.eslintrc.json deleted file mode 100644 index 2fe4f6a6b..000000000 --- a/tests/browser/.eslintrc.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "env": { - "browser": true, - "mocha": true, - "node": true - }, - "globals": { - "chai": false, - "sinon": false - }, - "rules": { - "no-unused-vars": ["off"], - // Allow uncommented helper functions in tests. - "require-jsdoc": ["off"], - "prefer-rest-params": ["off"], - "no-invalid-this": ["off"], - "valid-jsdoc": [ - "error", - { - "requireReturnType": false, - "requireParamType": false - } - ] - }, - "extends": "../../.eslintrc.js", - "parserOptions": { - "sourceType": "module" - } -} diff --git a/tests/migration/validate-renamings.mjs b/tests/migration/validate-renamings.mjs index d9c66ef9c..e7f9f4a70 100755 --- a/tests/migration/validate-renamings.mjs +++ b/tests/migration/validate-renamings.mjs @@ -25,38 +25,39 @@ const RENAMINGS_URL = new URL( import.meta.url, ); -const renamingsJson5 = await readFile(RENAMINGS_URL); -const renamings = JSON5.parse(renamingsJson5); +readFile(RENAMINGS_URL).then((renamingsJson5) => { + const renamings = JSON5.parse(renamingsJson5); -const output = await validate(SCHEMA_URL, renamings, BASIC); - -if (!output.valid) { - console.error(`Renamings file is invalid. First error occurs at: + validate(SCHEMA_URL, renamings, BASIC).then((output) => { + if (!output.valid) { + console.error(`Renamings file is invalid. First error occurs at: ${output.errors[0].instanceLocation}`); - console.info( - `Here is the full validator output, in case that helps:\n`, - output, - ); - process.exit(1); -} - -// File passed schema validation. Do some additional checks. -let ok = true; -Object.entries(renamings).forEach(([version, modules]) => { - // Scan through modules and check for duplicates. - const seen = new Set(); - for (const {oldName} of modules) { - if (seen.has(oldName)) { - console.error( - `Duplicate entry for module ${oldName} ` + `in version ${version}.`, + console.info( + `Here is the full validator output, in case that helps:\n`, + output, ); - ok = false; + process.exit(1); } - seen.add(oldName); - } + + // File passed schema validation. Do some additional checks. + let ok = true; + Object.entries(renamings).forEach(([version, modules]) => { + // Scan through modules and check for duplicates. + const seen = new Set(); + for (const {oldName} of modules) { + if (seen.has(oldName)) { + console.error( + `Duplicate entry for module ${oldName} ` + `in version ${version}.`, + ); + ok = false; + } + seen.add(oldName); + } + }); + if (!ok) { + console.error('Renamings file is invalid.'); + process.exit(1); + } + // Default is a successful exit 0. + }); }); -if (!ok) { - console.error('Renamings file is invalid.'); - process.exit(1); -} -// Default is a successful exit 0. diff --git a/tests/mocha/.eslintrc.json b/tests/mocha/.eslintrc.json deleted file mode 100644 index 0de898aa6..000000000 --- a/tests/mocha/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "env": { - "browser": true, - "mocha": true - }, - "globals": { - "chai": false, - "sinon": false - }, - "rules": { - "no-unused-vars": ["off"], - // Allow uncommented helper functions in tests. - "require-jsdoc": ["off"], - "prefer-rest-params": ["off"], - "no-invalid-this": ["off"] - }, - "extends": "../../.eslintrc.js", - "parserOptions": { - "sourceType": "module" - } -} diff --git a/tests/mocha/serializer_test.js b/tests/mocha/serializer_test.js index 0cc073e7b..a3a3761e9 100644 --- a/tests/mocha/serializer_test.js +++ b/tests/mocha/serializer_test.js @@ -484,7 +484,6 @@ Serializer.Fields.TextInput.Simple = new SerializerTestCase( '' + '', ); -/* eslint-disable no-tabs */ Serializer.Fields.TextInput.Tabs = new SerializerTestCase( 'Tabs', '' + @@ -493,7 +492,6 @@ Serializer.Fields.TextInput.Tabs = new SerializerTestCase( '' + '', ); -/* eslint-enable no-tabs */ Serializer.Fields.TextInput.Symbols = new SerializerTestCase( 'Symbols', '' + @@ -621,7 +619,6 @@ Serializer.Fields.Variable.Types = new SerializerTestCase( '' + '', ); -/* eslint-disable no-tabs */ Serializer.Fields.Variable.Tabs = new SerializerTestCase( 'Tabs', '' + @@ -633,7 +630,6 @@ Serializer.Fields.Variable.Tabs = new SerializerTestCase( '' + '', ); -/* eslint-enable no-tabs */ Serializer.Fields.Variable.Symbols = new SerializerTestCase( 'Symbols', '' + diff --git a/tests/mocha/test_helpers/code_generation.js b/tests/mocha/test_helpers/code_generation.js index 427b9bd51..95bd902cd 100644 --- a/tests/mocha/test_helpers/code_generation.js +++ b/tests/mocha/test_helpers/code_generation.js @@ -1,4 +1,3 @@ -/* eslint-disable valid-jsdoc */ /** * @license * Copyright 2020 Google LLC diff --git a/tests/mocha/workspace_test.js b/tests/mocha/workspace_test.js index a517d796c..20cdab6e4 100644 --- a/tests/mocha/workspace_test.js +++ b/tests/mocha/workspace_test.js @@ -20,6 +20,5 @@ suite('Workspace', function () { sharedTestTeardown.call(this); }); - // eslint-disable-next-line no-use-before-define testAWorkspace(); }); diff --git a/tests/node/.eslintrc.json b/tests/node/.eslintrc.json deleted file mode 100644 index c8e8d67c1..000000000 --- a/tests/node/.eslintrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "env": { - "node": true, - "browser": false, - "mocha": true - }, - "globals": { - "console": true, - "require": true - }, - "extends": "../../.eslintrc.js" -} diff --git a/tests/playgrounds/screenshot.js b/tests/playgrounds/screenshot.js index c443755a5..11a86ba1a 100644 --- a/tests/playgrounds/screenshot.js +++ b/tests/playgrounds/screenshot.js @@ -40,7 +40,7 @@ function svgToPng_(data, width, height, callback) { const dataUri = canvas.toDataURL('image/png'); callback(dataUri); } catch (err) { - console.warn('Error converting the workspace svg to a png'); + console.warn('Error converting the workspace svg to a png: ' + err); callback(''); } }; From cd1e540cca157d7b7b7ccfda521de3ec13372b91 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 3 Dec 2024 13:40:26 -0800 Subject: [PATCH 06/13] fix: Disable newly created function call blocks when the corresponding definition is disabled. (#8665) --- blocks/procedures.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/blocks/procedures.ts b/blocks/procedures.ts index bf9a9206b..20d8fa36b 100644 --- a/blocks/procedures.ts +++ b/blocks/procedures.ts @@ -1099,6 +1099,14 @@ const PROCEDURE_CALL_COMMON = { xml.appendChild(block); Xml.domToWorkspace(xml, this.workspace); Events.setGroup(false); + } else if (!def.isEnabled()) { + this.setDisabledReason( + true, + DISABLED_PROCEDURE_DEFINITION_DISABLED_REASON, + ); + this.setWarningText( + Msg['PROCEDURES_CALL_DISABLED_DEF_WARNING'].replace('%1', name), + ); } } else if (event.type === Events.BLOCK_DELETE) { // Look for the case where a procedure definition has been deleted, From 24ab50d49d3fddcbf270743883121435fad078ce Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 3 Dec 2024 13:41:32 -0800 Subject: [PATCH 07/13] fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device. (#8670) * fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device. * chore: Fix test failure. --- core/css.ts | 13 ++----------- core/toolbox/toolbox.ts | 1 - tests/mocha/toolbox_test.js | 5 +---- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/core/css.ts b/core/css.ts index 20c573093..2186af04a 100644 --- a/core/css.ts +++ b/core/css.ts @@ -79,6 +79,8 @@ let content = ` position: relative; overflow: hidden; /* So blocks in drag surface disappear at edges */ touch-action: none; + user-select: none; + -webkit-user-select: none; } .blocklyNonSelectable { @@ -266,17 +268,6 @@ let content = ` cursor: default; } -/* - Don't allow users to select text. It gets annoying when trying to - drag a block and selected text moves instead. -*/ -.blocklySvg text { - user-select: none; - -ms-user-select: none; - -webkit-user-select: none; - cursor: inherit; -} - .blocklyHidden { display: none; } diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index 457d5d43b..120378393 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -197,7 +197,6 @@ export class Toolbox const toolboxContainer = document.createElement('div'); toolboxContainer.setAttribute('layout', this.isHorizontal() ? 'h' : 'v'); dom.addClass(toolboxContainer, 'blocklyToolboxDiv'); - dom.addClass(toolboxContainer, 'blocklyNonSelectable'); toolboxContainer.setAttribute('dir', this.RTL ? 'RTL' : 'LTR'); return toolboxContainer; } diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js index 70f5ff8f9..3b69fac5d 100644 --- a/tests/mocha/toolbox_test.js +++ b/tests/mocha/toolbox_test.js @@ -47,10 +47,7 @@ suite('Toolbox', function () { test('Init called -> HtmlDiv is inserted before parent node', function () { const toolboxDiv = Blockly.common.getMainWorkspace().getInjectionDiv() .childNodes[0]; - assert.equal( - toolboxDiv.className, - 'blocklyToolboxDiv blocklyNonSelectable', - ); + assert.equal(toolboxDiv.className, 'blocklyToolboxDiv'); }); test('Init called -> Toolbox is subscribed to background and foreground colour', function () { const themeManager = this.toolbox.workspace_.getThemeManager(); From 09bdd39cb23bcfaa9c7bc02a50294d2e8d9b446e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:47:10 -0800 Subject: [PATCH 08/13] chore(deps): bump eslint from 8.57.0 to 9.16.0 (#8680) Bumps [eslint](https://github.com/eslint/eslint) from 8.57.0 to 9.16.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.57.0...v9.16.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff83cb6d8..7bd880eb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -332,9 +332,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.15.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.15.0.tgz", - "integrity": "sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg==", + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", + "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3553,9 +3553,9 @@ } }, "node_modules/eslint": { - "version": "9.15.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.15.0.tgz", - "integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==", + "version": "9.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", + "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", @@ -3563,7 +3563,7 @@ "@eslint/config-array": "^0.19.0", "@eslint/core": "^0.9.0", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.15.0", + "@eslint/js": "9.16.0", "@eslint/plugin-kit": "^0.2.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", From 43ebf20500fbc599408e1081fcb1bd7ab580242d Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 3 Dec 2024 14:17:09 -0800 Subject: [PATCH 09/13] chore: Remove CSS targeting multiline input field. (#8684) --- core/css.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/css.ts b/core/css.ts index 2186af04a..c7443e5f0 100644 --- a/core/css.ts +++ b/core/css.ts @@ -251,10 +251,6 @@ let content = ` stroke: none; } -.blocklyMultilineText { - font-family: monospace; -} - .blocklyNonEditableText>text { pointer-events: none; } From 6118ffe8fcd0bb446a2dd9f4bff3d0b12a27edf4 Mon Sep 17 00:00:00 2001 From: Aaron Dodson Date: Tue, 3 Dec 2024 14:48:41 -0800 Subject: [PATCH 10/13] chore: Remove obsolete workaround for resize events on iPads. (#8669) --- core/inject.ts | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/core/inject.ts b/core/inject.ts index 55409b7f3..b425d77b7 100644 --- a/core/inject.ts +++ b/core/inject.ts @@ -22,7 +22,6 @@ import * as Touch from './touch.js'; import * as aria from './utils/aria.js'; import * as dom from './utils/dom.js'; import {Svg} from './utils/svg.js'; -import * as userAgent from './utils/useragent.js'; import * as WidgetDiv from './widgetdiv.js'; import {WorkspaceSvg} from './workspace_svg.js'; @@ -337,18 +336,6 @@ function bindDocumentEvents() { // should run regardless of what other touch event handlers have run. browserEvents.bind(document, 'touchend', null, Touch.longStop); browserEvents.bind(document, 'touchcancel', null, Touch.longStop); - // Some iPad versions don't fire resize after portrait to landscape change. - if (userAgent.IPAD) { - browserEvents.conditionalBind( - window, - 'orientationchange', - document, - function () { - // TODO (#397): Fix for multiple Blockly workspaces. - common.svgResize(common.getMainWorkspace() as WorkspaceSvg); - }, - ); - } } documentEventsBound = true; } From eb79f667e2590bf48b37492c73e532bec2aa18b1 Mon Sep 17 00:00:00 2001 From: echoooooo <2070343088@email.szu.edu.cn> Date: Thu, 5 Dec 2024 00:54:34 +0800 Subject: [PATCH 11/13] fix: typo in comment (#8685) --- core/generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/generator.ts b/core/generator.ts index 869e29a6a..5884b4e54 100644 --- a/core/generator.ts +++ b/core/generator.ts @@ -24,7 +24,7 @@ import type {Workspace} from './workspace.js'; * @deprecated * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/generating-code} * @param block The Block instance to generate code for. - * @param genearator The CodeGenerator calling the function. + * @param generator The CodeGenerator calling the function. * @returns A string containing the generated code (for statement blocks), * or a [code, precedence] tuple (for value/expression blocks), or * null if no code should be emitted for block. From 72198001831a81a63d840faf8de267b7da92c0a8 Mon Sep 17 00:00:00 2001 From: "Mateus S. Pereira" <68961261+mateusslezinsky@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:25:01 -0300 Subject: [PATCH 12/13] fix: workspace shifts when deleting a block (#8666) * fix: workspace shifts when deleting a block * fix: awaiting for block rerender * fix: create reusable method to prevent marking method as async --- core/dragging/block_drag_strategy.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/dragging/block_drag_strategy.ts b/core/dragging/block_drag_strategy.ts index c3be97da6..c9a1ea0ab 100644 --- a/core/dragging/block_drag_strategy.ts +++ b/core/dragging/block_drag_strategy.ts @@ -384,19 +384,24 @@ export class BlockDragStrategy implements IDragStrategy { if (this.connectionCandidate) { // Applying connections also rerenders the relevant blocks. this.applyConnections(this.connectionCandidate); + this.disposeStep(); } else { - this.block.queueRender(); + this.block.queueRender().then(() => this.disposeStep()); } + + if (!this.inGroup) { + eventUtils.setGroup(false); + } + } + + /** Disposes of any state at the end of the drag. */ + private disposeStep() { this.block.snapToGrid(); // Must dispose after connections are applied to not break the dynamic // connections plugin. See #7859 this.connectionPreviewer!.dispose(); this.workspace.setResizesEnabled(true); - - if (!this.inGroup) { - eventUtils.setGroup(false); - } } /** Connects the given candidate connections. */ From 4680b4b5c1b4606fa147289125ed0bd4666babbd Mon Sep 17 00:00:00 2001 From: Christopher Allen Date: Wed, 4 Dec 2024 17:30:22 +0000 Subject: [PATCH 13/13] test: Disable failing tests (#8677) See issue #8676. --- tests/mocha/workspace_svg_test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/mocha/workspace_svg_test.js b/tests/mocha/workspace_svg_test.js index 8282e7ac2..0cd6da828 100644 --- a/tests/mocha/workspace_svg_test.js +++ b/tests/mocha/workspace_svg_test.js @@ -502,7 +502,8 @@ suite('WorkspaceSvg', function () { ); }); - test('two blocks first at (10, 15) second at (0, 0) do not switch places', function () { + // TODO(#8676): Reenable once test passes reliably. + test.skip('two blocks first at (10, 15) second at (0, 0) do not switch places', function () { const blockJson1 = { 'type': 'math_number', 'id': 'block1', @@ -538,7 +539,8 @@ suite('WorkspaceSvg', function () { ); }); - test('two overlapping blocks are moved to origin and below', function () { + // TODO(#8676): Reenable once test passes reliably. + test.skip('two overlapping blocks are moved to origin and below', function () { const blockJson1 = { 'type': 'math_number', 'id': 'block1', @@ -618,7 +620,8 @@ suite('WorkspaceSvg', function () { ); }); - test('two overlapping blocks are moved to origin and below including children', function () { + // TODO(#8676): Reenable once test passes reliably. + test.skip('two overlapping blocks are moved to origin and below including children', function () { const blockJson1 = { 'type': 'logic_negate', 'id': 'block1', @@ -682,7 +685,8 @@ suite('WorkspaceSvg', function () { ); }); - test('two large overlapping blocks are moved to origin and below', function () { + // TODO(#8676): Reenable once test passes reliably. + test.skip('two large overlapping blocks are moved to origin and below', function () { const blockJson1 = { 'type': 'controls_repeat_ext', 'id': 'block1',