Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove lodash #1440

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

remove lodash #1440

wants to merge 2 commits into from

Conversation

sdalonzo
Copy link
Collaborator

No description provided.

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e89da32) 94.46% compared to head (2b1c4f9) 93.86%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1440      +/-   ##
==========================================
- Coverage   94.46%   93.86%   -0.60%     
==========================================
  Files         214      144      -70     
  Lines        9549     9434     -115     
  Branches      638      612      -26     
==========================================
- Hits         9020     8855     -165     
- Misses        515      562      +47     
- Partials       14       17       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sdalonzo sdalonzo force-pushed the no-mo-lodash branch 5 times, most recently from 50a6ef4 to 3877634 Compare January 24, 2024 04:02
@sdalonzo sdalonzo force-pushed the no-mo-lodash branch 4 times, most recently from 87ab964 to dbdb2b1 Compare January 24, 2024 04:47
const update = (path) => {
const Node = path.value

// Dumb way to skip text elements since they also can have an align prop
if (get(Node, 'openingElement.name.name', '').toLowerCase().includes('text')) {
if (Node?.openingElement?.name?.name?.toLowerCase()?.includes('text')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(super-n-b) If that last name returns, toLowerCase() should work, no?

Suggested change
if (Node?.openingElement?.name?.name?.toLowerCase()?.includes('text')) {
if (Node?.openingElement?.name?.name?.toLowerCase().includes('text')) {

packages/core/src/stories/Colors.stories.tsx Show resolved Hide resolved
Comment on lines +2 to +5
return string
.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/[\s_]+/g, '-')
.toLowerCase()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't return exactly the same results as lodash's version, but I'm not sure how true to the original we need to be. The most obvious difference is that hyphens can end up leading or trailing characters -- is it worth an enhancement to trim that?
Screenshot 2024-01-24 at 7 15 24 AM
Screenshot 2024-01-24 at 7 16 10 AM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! it's a naive copy from the internet, first goal was to get it building and measure the bundle change

} from './constants'
import debounce from 'lodash.debounce'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n-b) Kind of amazing that this was the only usage in DS

export function debounce(func, wait, immediate) {
let timeout
return function () {
const context = this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n-b) At least you didn't call it that 🤣


export function debounce(func, wait, immediate) {
let timeout
return function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to spread the arguments into this function? I had assumed that this creates a new scope for the args setting below and comes up empty.

import * as icons from './index'

function upperFirst(string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n-b) You've written this function twice -- the other instance is in utils
It's so small that repetition is probably fine, but do you want to consolidate?

@@ -21,7 +21,7 @@
* Specify a SemVer range to ensure developers use a Node.js version that is appropriate
* for your repo.
*/
"nodeSupportedVersionRange": ">=16",
"nodeSupportedVersionRange": ">=18",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n-b) This get missed in the v6 pull?

@@ -33,7 +33,6 @@
"@babel/core": "^7.22.15",
"@priceline/babel-preset": "workspace:*",
"@priceline/eslint-config": "workspace:*",
"@reach/component-component": "^0.16.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n-b) Oh, missed this one -- unused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants