diff --git a/eslint.config.mjs b/eslint.config.mjs index efe82f60aab81..0fd9ab5b9e65c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -164,6 +164,7 @@ export default [ "unicorn/no-incorrect-query-selector": "error", "unicorn/no-instanceof-builtins": "error", "unicorn/no-invalid-remove-event-listener": "error", + "unicorn/no-multiple-promise-resolver-calls": "error", "unicorn/no-new-buffer": "error", "unicorn/no-single-promise-in-promise-methods": "error", "unicorn/no-typeof-undefined": ["error", { checkGlobalVariables: false }], diff --git a/gulpfile.mjs b/gulpfile.mjs index 535889aaa0a86..0d86e890b8024 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -883,6 +883,7 @@ function runTests(testsName, { bot = false } = {}) { testProcess.on("close", function (code) { if (code !== 0) { reject(new Error(`Running ${testsName} tests failed.`)); + return; } resolve(); }); diff --git a/web/ui_utils.js b/web/ui_utils.js index 3e1252f67ef63..b7c52ab226b33 100644 --- a/web/ui_utils.js +++ b/web/ui_utils.js @@ -399,6 +399,11 @@ function backtrackBeforeAllVisibleElements(index, views, top) { return index; } +function visibleSort(a, b) { + const pc = a.percent - b.percent; + return Math.abs(pc) > 0.001 ? -pc : a.id - b.id; // ensure stability +} + /** * @typedef {Object} GetVisibleElementsParameters * @property {HTMLElement} scrollEl - A container that can possibly scroll. @@ -576,13 +581,7 @@ function getVisibleElements({ last = visible.at(-1); if (sortByVisibility) { - visible.sort(function (a, b) { - const pc = a.percent - b.percent; - if (Math.abs(pc) > 0.001) { - return -pc; - } - return a.id - b.id; // ensure stability - }); + visible.sort(visibleSort); } return { first, last, views: visible, ids }; }