helpscout / hsds-react

Help Scout Design System (HSDS) — React Component Library
MIT License
86 stars 17 forks source link

[HSDS4-32][HSDS4-15] Processing utils, pt 2 #1037

Closed tinkertrain closed 2 years ago

tinkertrain commented 2 years ago

Continue the processing of utilities inside HSDS.

https://helpscout.atlassian.net/browse/HSDS4-32 https://helpscout.atlassian.net/browse/HSDS4-15

Should merge https://github.com/helpscout/hsds-react/pull/1031 first ✅

After analyzing the usage of utilities in:

utilities.pdf

This PR makes the following changes:

Again, I tried to be very clean with commits so one change is one commit for the most part

utilities/actions.js

Removed. Only used in the old Dropdown, incorporated there.

utilities/animation.js

Removed. Integrated getSequenceNames into Animate

utilities/browser.js

Removed. Only used internally twice, so moved there (isFirefox to Overflow, isSafari to ScrollLock)

utilities/check.js

Removed. Moved allDefined to ChatScroller.utils.js. Rest unused

utilities/classNames.js

utilities/collection.js

Removed. Not used.

utilities/debounce.js

Removed. Use lodash.debounce instead (already a dependency)

utilities/env.js

Removed. Not used.

utilities/events.js

utilities/get.js

Removed. Use lodash.get instead (already a dependency)

utilities/globalManager.js

Removed. Integrated setupManager into PortalWrapper

utilities/history.js

Removed. Incorporate createLocation into RouteWrapper.

utilities/Images.js

Removed. Incorporate calculateAspectRatioFit into Image.utils.js

utilities/memoize.js and utilities/memoizeOne.js

Removed. Only used in the old Dropdown, incorporated there.

utilities/nodePosition.js

Removed. Incorporated into Drop.Positioner

utilities/other.js

Removed requestAnimationFrame shim, reason for it no longer exists (JSDOM incorporates it)

utilities/pluralize.js

utilities/scrolling.js

Incorporate remapScrollingPlane into Overflow

utilities/storybook.js

Removed withAktiv from stories

utilities/strings.js

utilities/timestamp.js

Removed. Incorporated into Timestamp

utilities/react-router/matchPath.js

Removed. Incorporated into PortalWrapper

Test Coverage

Again, percentage dropped even though no tests of actually used utils were deleted, but moved. Things like the utils I moved into the old Dropdown were artificially upping the percentage. Lowered to 85%

Apps test

Released a beta and tested in:

cloudflare-pages[bot] commented 2 years ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1fa158a
Status: ✅  Deploy successful!
Preview URL: https://ca1a9380.hsds-react.pages.dev

View logs