-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Use export * in utility indexes too #2636
Conversation
aafb3dd
to
a290073
Compare
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.
Seems good, a few comments
@@ -2,9 +2,7 @@ import {isServer} from '../target'; | |||
|
|||
export const SCROLL_LOCKING_ATTRIBUTE = 'data-lock-scrolling'; | |||
|
|||
export const SCROLL_LOCKING_WRAPPER_ATTRIBUTE = 'data-lock-scrolling-wrapper'; | |||
|
|||
export const SCROLL_LOCKING_CUSTOM_PROPERTY = '--scroll-lock-body-padding'; |
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.
are you sure we can remove 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 checked for usages and there were none outside the current file, I then removed the export
and it complained that it was never used inside this file either
|
||
export {Theme, ThemeConfig, CustomPropertiesLike, ColorScheme} from './types'; | ||
export {ThemeConfig} from './types'; |
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.
Why not export * here?
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.
There's a bunch of other types in that file that are used within this folder, but not externally. As most of this is going to be extracted into polaris-tokens pretty soon it didn't seem worth the refactoring to split this into a types and private-types file.
WHY are these changes introduced?
Following on from #2619 and #2625 I looked at the utility index files and spotted that in almost all cases our index files rexport everything in the files they reference, or what they references is never used externally, so they can also use
export *
too.WHAT is this pull request doing?
export *
because doing things one way everywhere is easier than doing things one way incomponents
and another way inutilities
I did run into some issues with some interfaces that get used as the type that gets pushed into a React context.
I could either have those as a type or export the interface. I figured exporting the interface was an acceptable compromise as "a slightly leaky internal export that doesn't bleed into our public exports" was better than "disabling our linting rule that prefers the usage of interfaces over types".
How to 🎩
Type check and tests pass