-
Notifications
You must be signed in to change notification settings - Fork 428
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
refactor: use transient props in various styled components #5093
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
focus: boolean | ||
hover: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were removed as the styled component wasn't doing anything with these values
onMouseEnter={handleMouseEnter} | ||
onMouseLeave={handleMouseLeave} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, this internal state has been removed as ChangeBarWrapper
isn't varying on the value of hover
// We exclude `documentId` from spread props to avoid passing it to the Card component | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
documentId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to know if there's a more elegant way to do this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to assingn it to _
and have eslint ignore it, e.g. documentId: _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this! Though I believe we need to amend our eslint config slightly to accommodate, e.g.
'@typescript-eslint/no-unused-vars': [
'warn',
{
varsIgnorePattern: '^_',
},
],
Happy to add if you feel appropriate! Otherwise we can just leave as-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since const {foo: _, bar: _, ...rest} = …
will yell at you for redeclaring consts, will that rule allow omitting more than one property? Maybe we could configure it to be _ignore_${propertyName}
(or maybe that's too much?).
There's also no-unused-vars#ignorerestsiblings, which is more specific to this particular case.
content={content} | ||
// data-placement={restProps.placement} | ||
portal | ||
allowedAutoPlacements={['top', 'bottom']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as it's now deprecated in Sanity UI, and including it would yield similar transient prop warnings
No changes to documentation |
Component Testing Report Updated Oct 30, 2023 6:16 PM (UTC)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great - thanks a lot @robinpyon! 🙇🏼
// We exclude `documentId` from spread props to avoid passing it to the Card component | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
documentId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to assingn it to _
and have eslint ignore it, e.g. documentId: _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me. Thanks!
Description
This PR migrates a number of styled components to now use transient props, and remove a number of warnings that were shown in localhost as a result of upgrading to styled-components to
6.x
.A fully exhaustive audit wasn't conducted, but this should address most of the more common / egregious examples.
What to review
Touched components should be unaffected in function or style. We should no longer see a glut of transient prop related warnings in localhost.
Notes for release
N/A