Skip to content

feat(eslint-plugin): enable no-export-all:all for all packages public…#22073

Merged
Hotell merged 4 commits intomicrosoft:masterfrom
Hotell:hotell/build-system/enforce-no-export-all-for-v9
Mar 15, 2022
Merged

feat(eslint-plugin): enable no-export-all:all for all packages public…#22073
Hotell merged 4 commits intomicrosoft:masterfrom
Hotell:hotell/build-system/enforce-no-export-all-for-v9

Conversation

@Hotell
Copy link
Contributor

@Hotell Hotell commented Mar 11, 2022

… API

Current Behavior

  • we allow export * from for internal modules
  • export * from is dissallowed for external packages only for dedups/tree shake-ability reasons
// @filename src/index.ts
// OK  ✅
export * from './Foo'
// Error 🚨
export * from 'lib-a'

// @filename src/Foo/index.ts
// OK ✅
export * from './Foo'
// Error 🚨
export * from 'lib-a'

New Behavior

  • to improve tree-shaking capabilities even further we should dissallow export * for all public API's
    • this already happens for react-components although only for "external" dependencies - THIS PR adds check for internal ones ✅
// @filename src/index.ts
// Error 🚨 - export * is bad idea for tree shake-ability on public API surface
export * from './Foo'
// Error 🚨
export * from 'lib-a'

// @filename src/Foo/index.ts
// OK ✅ - this is fine, no need to be explicit in every module
export * from './Foo'
// Error 🚨
export * from 'lib-a'

To recap new functionality:

  • export * for external packages is dissallowed in every module
  • public apis of packages (index.ts,index.tsx,index.js) are dissalowed to use export *
v9-package-public-api.mov

Related Issue(s)

Follows #22046

Remarks

  • for easy gradual migration the lint is set to warn, after we fix all v9 packages gradually it will be propagated to error

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 11, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4bb197e:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 11, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1015 1085 5000
Button mount 661 663 5000
FluentProvider mount 2119 2113 5000
FluentProviderWithTheme mount 307 317 10
FluentProviderWithTheme virtual-rerender 259 275 10
FluentProviderWithTheme virtual-rerender-with-unmount 364 342 10
MakeStyles mount 1804 1840 50000

@size-auditor
Copy link

size-auditor bot commented Mar 11, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 9e1c2c15517bad89b33c61729fb56f4c95739ca2 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 11, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
priority-overflow
createOverflowManager
2.836 kB
1.209 kB
react-accordion
Accordion (including children components)
74.658 kB
22.47 kB
react-avatar
Avatar
44.982 kB
13.059 kB
react-badge
Badge
20.869 kB
6.549 kB
react-badge
CounterBadge
21.737 kB
6.843 kB
react-badge
PresenceBadge
21.866 kB
6.536 kB
react-button
Button
28.013 kB
8.059 kB
react-button
CompoundButton
33.336 kB
9.037 kB
react-button
MenuButton
29.763 kB
8.656 kB
react-button
SplitButton
36.235 kB
9.857 kB
react-button
ToggleButton
37.395 kB
8.68 kB
react-card
Card - All
53.205 kB
15.27 kB
react-card
Card
48.898 kB
14.083 kB
react-card
CardFooter
7.653 kB
3.246 kB
react-card
CardHeader
8.931 kB
3.689 kB
react-card
CardPreview
7.626 kB
3.272 kB
react-combobox
Combobox
6.813 kB
2.895 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
175.69 kB
48.974 kB
react-components
react-components: FluentProvider & webLightTheme
32.526 kB
10.645 kB
react-divider
Divider
15.301 kB
5.532 kB
react-image
Image
10.105 kB
3.952 kB
react-input
Input
21.538 kB
7.134 kB
react-label
Label
8.341 kB
3.487 kB
react-link
Link
11.102 kB
4.504 kB
react-menu
Menu (including children components)
105.599 kB
32.356 kB
react-menu
Menu (including selectable components)
107.954 kB
32.722 kB
react-popover
Popover
96.776 kB
29.553 kB
react-portal
Portal
6.267 kB
2.168 kB
react-positioning
usePopper
23.21 kB
8.084 kB
react-priority-overflow
hooks only
10.606 kB
4.087 kB
react-provider
FluentProvider
14.009 kB
5.25 kB
react-select
Select
7.754 kB
3.258 kB
react-slider
Slider
25.402 kB
8.251 kB
react-spinner
Spinner
6.811 kB
2.895 kB
react-switch
Switch
24.245 kB
7.986 kB
react-text
Text - Default
10.793 kB
4.23 kB
react-text
Text - Wrappers
14.107 kB
4.573 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
29.426 kB
6.551 kB
react-theme
Teams: Light theme
18.42 kB
5.27 kB
react-tooltip
Tooltip
42.76 kB
14.701 kB
react-utilities
SSRProvider
189 B
161 B
🤖 This report was generated against 9e1c2c15517bad89b33c61729fb56f4c95739ca2

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 11, 2022

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
DividerMinimalPerf.default 308 264 1.17:1
DialogMinimalPerf.default 656 582 1.13:1
AccordionMinimalPerf.default 138 126 1.1:1
DropdownMinimalPerf.default 2759 2535 1.09:1
LayoutMinimalPerf.default 324 299 1.08:1
AttachmentMinimalPerf.default 144 135 1.07:1
ItemLayoutMinimalPerf.default 1013 944 1.07:1
PortalMinimalPerf.default 160 150 1.07:1
AttachmentSlotsPerf.default 869 823 1.06:1
ListCommonPerf.default 536 505 1.06:1
ListMinimalPerf.default 437 412 1.06:1
RosterPerf.default 957 907 1.06:1
ChatDuplicateMessagesPerf.default 262 250 1.05:1
FlexMinimalPerf.default 255 243 1.05:1
SkeletonMinimalPerf.default 300 286 1.05:1
AvatarMinimalPerf.default 156 150 1.04:1
CarouselMinimalPerf.default 403 386 1.04:1
HeaderMinimalPerf.default 320 309 1.04:1
ListNestedPerf.default 487 469 1.04:1
ListWith60ListItems.default 568 550 1.03:1
TextMinimalPerf.default 300 290 1.03:1
VideoMinimalPerf.default 566 550 1.03:1
BoxMinimalPerf.default 299 294 1.02:1
ButtonOverridesMissPerf.default 1416 1395 1.02:1
ChatWithPopoverPerf.default 345 339 1.02:1
FormMinimalPerf.default 345 338 1.02:1
TableMinimalPerf.default 351 343 1.02:1
TooltipMinimalPerf.default 872 857 1.02:1
AlertMinimalPerf.default 239 236 1.01:1
ButtonMinimalPerf.default 146 144 1.01:1
InputMinimalPerf.default 1102 1096 1.01:1
LabelMinimalPerf.default 330 328 1.01:1
LoaderMinimalPerf.default 583 578 1.01:1
MenuMinimalPerf.default 728 723 1.01:1
PopupMinimalPerf.default 543 536 1.01:1
RefMinimalPerf.default 208 206 1.01:1
SplitButtonMinimalPerf.default 3695 3646 1.01:1
CustomToolbarPrototype.default 3514 3492 1.01:1
ButtonSlotsPerf.default 469 468 1:1
EmbedMinimalPerf.default 3489 3504 1:1
HeaderSlotsPerf.default 638 639 1:1
ImageMinimalPerf.default 327 326 1:1
MenuButtonMinimalPerf.default 1438 1432 1:1
ProviderMergeThemesPerf.default 1478 1478 1:1
SegmentMinimalPerf.default 300 299 1:1
SliderMinimalPerf.default 1432 1428 1:1
IconMinimalPerf.default 517 517 1:1
TableManyItemsPerf.default 1615 1607 1:1
CardMinimalPerf.default 469 473 0.99:1
ChatMinimalPerf.default 621 628 0.99:1
GridMinimalPerf.default 286 290 0.99:1
ProviderMinimalPerf.default 962 974 0.99:1
RadioGroupMinimalPerf.default 368 371 0.99:1
ReactionMinimalPerf.default 318 320 0.99:1
TreeMinimalPerf.default 680 686 0.99:1
TreeWith60ListItems.default 154 156 0.99:1
AnimationMinimalPerf.default 457 464 0.98:1
CheckboxMinimalPerf.default 2206 2254 0.98:1
DatepickerMinimalPerf.default 4762 4840 0.98:1
StatusMinimalPerf.default 558 567 0.98:1
TextAreaMinimalPerf.default 403 410 0.98:1
DropdownManyItemsPerf.default 584 1490 0.39:1
ToolbarMinimalPerf.default 754 2463 0.31:1

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 11, 2022

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 905 918 5000
Breadcrumb mount 2603 2626 1000
Checkbox mount 1443 1465 5000
CheckboxBase mount 1239 1249 5000
ChoiceGroup mount 4667 4679 5000
ComboBox mount 976 963 1000
CommandBar mount 10157 10185 1000
ContextualMenu mount 11373 11461 1000
DefaultButton mount 1139 1122 5000
DetailsRow mount 3729 3761 5000
DetailsRowFast mount 3750 3806 5000
DetailsRowNoStyles mount 3458 3537 5000
Dialog mount 2214 2133 1000
DocumentCardTitle mount 163 154 1000
Dropdown mount 3253 3267 5000
FocusTrapZone mount 1769 1791 5000
FocusZone mount 1751 1803 5000
IconButton mount 1705 1728 5000
Label mount 341 352 5000
Layer mount 2884 2847 5000
Link mount 451 463 5000
MenuButton mount 1458 1476 5000
MessageBar mount 2104 2108 5000
Nav mount 3246 3286 1000
OverflowSet mount 1098 1108 5000
Panel mount 2158 2141 1000
Persona mount 825 841 1000
Pivot mount 1475 1457 1000
PrimaryButton mount 1292 1283 5000
Rating mount 7601 7478 5000
SearchBox mount 1279 1296 5000
Shimmer mount 2448 2427 5000
Slider mount 1891 1925 5000
SpinButton mount 4910 4978 5000
Spinner mount 419 423 5000
SplitButton mount 3069 3123 5000
Stack mount 526 518 5000
StackWithIntrinsicChildren mount 2295 2261 5000
StackWithTextChildren mount 5202 5178 5000
SwatchColorPicker mount 11409 11534 5000
TagPicker mount 2673 2661 5000
TeachingBubble mount 92028 91411 5000
Text mount 428 423 5000
TextField mount 1388 1370 5000
ThemeProvider mount 1178 1182 5000
ThemeProvider virtual-rerender 638 645 5000
ThemeProvider virtual-rerender-with-unmount 1805 1841 5000
Toggle mount 776 769 5000
buttonNative mount 116 122 5000

@Hotell Hotell marked this pull request as ready for review March 11, 2022 15:25
@Hotell Hotell requested review from a team as code owners March 11, 2022 15:25
Copy link
Member

@dzearing dzearing left a comment

Choose a reason for hiding this comment

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

Away with star *! LGTM!

@ling1726 ling1726 closed this Mar 11, 2022
@ling1726 ling1726 reopened this Mar 11, 2022
…3a9bb.json

Co-authored-by: Elizabeth Craig <ecraig12345@gmail.com>
@Hotell Hotell enabled auto-merge (squash) March 15, 2022 10:36
@Hotell Hotell merged commit fcbdedc into microsoft:master Mar 15, 2022
@Hotell Hotell deleted the hotell/build-system/enforce-no-export-all-for-v9 branch March 16, 2022 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

9 participants