Remove unused canScrollUp and canScrollDown helpers
What does this MR do and why?
Removes canScrollUp and canScrollDown from app/assets/javascripts/lib/utils/dom_utils.js, and the addScrollListener method of the web terminal that was their only caller.
The caller was checked and found unreachable:
terminal/terminal.jsis imported only byterminal/index.js, which constructs the terminal and never callsaddScrollListener.- A search of every file type in the repository finds no other call to
addScrollListeneron a terminal, and no other use of the two helpers outside their own spec.
With the method gone, the throttle import and the SCROLL_MARGIN constant in the terminal have no users and go too. The spec examples for the two helpers and their TEST_MARGIN constant are removed with them.
This removes the last two exports that import-x/no-deprecated could report on. The three eslint-disable comments for that rule go with them.
How to set up and validate locally
yarn jest spec/frontend/lib/utils/dom_utils_spec.js
rg -n 'canScrollUp|canScrollDown|addScrollListener\(' app ee/app spec ee/specThe spec passes. The search returns only the unrelated addScrollListener methods in resize_observer.js and the virtual scroll list, and a local data field in the Duo chat scroll region.
To check the web terminal still opens, run a project with a web terminal enabled and open its terminal page. The terminal renders, fits its container, and disposes on navigation as before.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
References
- Found while profiling ESLint in #630872 (closed).
import-x/no-deprecatedcosts about 45 s per full run and these were its last reportable exports. - Sibling removal of unused deprecated
Apimethods: !257740 (merged) - Prompted by the
eslint-plugin-import-xswitch in !257578 (merged)