chore: new eslint rule ban-context-export#23141
Conversation
This PR introduces a new eslint rule to ban exporting context objects from Fluent UI [you can read more detailed documentation here]()
|
Once #23092 gets merged (it removes some already exported contexts) CI should be green |
|
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 fdf2022:
|
ban-context-export
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 849 | 903 | 5000 | |
| Button | mount | 517 | 554 | 5000 | |
| FluentProvider | mount | 1828 | 1810 | 5000 | |
| FluentProviderWithTheme | mount | 263 | 290 | 10 | |
| FluentProviderWithTheme | virtual-rerender | 244 | 235 | 10 | |
| FluentProviderWithTheme | virtual-rerender-with-unmount | 320 | 306 | 10 | |
| MakeStyles | mount | 1533 | 1547 | 50000 |
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: de233f964c22b5d61d40fca656762bad66f77f6b (build) |
📊 Bundle size reportUnchanged fixtures
|
Perf Analysis (
|
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| ImageMinimalPerf.default | 326 | 291 | 1.12:1 |
| ChatMinimalPerf.default | 628 | 567 | 1.11:1 |
| DropdownManyItemsPerf.default | 549 | 502 | 1.09:1 |
| AnimationMinimalPerf.default | 434 | 401 | 1.08:1 |
| FlexMinimalPerf.default | 244 | 228 | 1.07:1 |
| ButtonSlotsPerf.default | 450 | 425 | 1.06:1 |
| InputMinimalPerf.default | 1086 | 1023 | 1.06:1 |
| ListWith60ListItems.default | 511 | 488 | 1.05:1 |
| RefMinimalPerf.default | 201 | 191 | 1.05:1 |
| SegmentMinimalPerf.default | 273 | 261 | 1.05:1 |
| StatusMinimalPerf.default | 577 | 550 | 1.05:1 |
| ButtonMinimalPerf.default | 140 | 134 | 1.04:1 |
| DividerMinimalPerf.default | 304 | 292 | 1.04:1 |
| ListMinimalPerf.default | 431 | 416 | 1.04:1 |
| DropdownMinimalPerf.default | 2503 | 2422 | 1.03:1 |
| HeaderMinimalPerf.default | 269 | 262 | 1.03:1 |
| ItemLayoutMinimalPerf.default | 972 | 946 | 1.03:1 |
| LayoutMinimalPerf.default | 296 | 288 | 1.03:1 |
| MenuMinimalPerf.default | 701 | 683 | 1.03:1 |
| SkeletonMinimalPerf.default | 279 | 270 | 1.03:1 |
| SplitButtonMinimalPerf.default | 3592 | 3496 | 1.03:1 |
| ButtonOverridesMissPerf.default | 1238 | 1214 | 1.02:1 |
| CarouselMinimalPerf.default | 394 | 386 | 1.02:1 |
| DatepickerMinimalPerf.default | 4728 | 4617 | 1.02:1 |
| ListCommonPerf.default | 518 | 506 | 1.02:1 |
| TableManyItemsPerf.default | 1564 | 1537 | 1.02:1 |
| BoxMinimalPerf.default | 243 | 240 | 1.01:1 |
| ChatWithPopoverPerf.default | 305 | 302 | 1.01:1 |
| EmbedMinimalPerf.default | 3356 | 3336 | 1.01:1 |
| LabelMinimalPerf.default | 311 | 309 | 1.01:1 |
| ProviderMinimalPerf.default | 339 | 336 | 1.01:1 |
| RadioGroupMinimalPerf.default | 370 | 368 | 1.01:1 |
| IconMinimalPerf.default | 525 | 521 | 1.01:1 |
| CustomToolbarPrototype.default | 2280 | 2247 | 1.01:1 |
| ToolbarMinimalPerf.default | 795 | 788 | 1.01:1 |
| ChatDuplicateMessagesPerf.default | 230 | 229 | 1:1 |
| ListNestedPerf.default | 455 | 455 | 1:1 |
| RosterPerf.default | 875 | 875 | 1:1 |
| PortalMinimalPerf.default | 142 | 142 | 1:1 |
| ReactionMinimalPerf.default | 278 | 279 | 1:1 |
| DialogMinimalPerf.default | 630 | 635 | 0.99:1 |
| PopupMinimalPerf.default | 520 | 523 | 0.99:1 |
| SliderMinimalPerf.default | 1343 | 1360 | 0.99:1 |
| AttachmentSlotsPerf.default | 848 | 866 | 0.98:1 |
| HeaderSlotsPerf.default | 629 | 644 | 0.98:1 |
| TextMinimalPerf.default | 278 | 284 | 0.98:1 |
| TextAreaMinimalPerf.default | 381 | 389 | 0.98:1 |
| TreeMinimalPerf.default | 647 | 668 | 0.97:1 |
| CardMinimalPerf.default | 443 | 462 | 0.96:1 |
| CheckboxMinimalPerf.default | 2141 | 2227 | 0.96:1 |
| LoaderMinimalPerf.default | 495 | 513 | 0.96:1 |
| TableMinimalPerf.default | 317 | 331 | 0.96:1 |
| ProviderMergeThemesPerf.default | 995 | 1044 | 0.95:1 |
| FormMinimalPerf.default | 303 | 321 | 0.94:1 |
| AttachmentMinimalPerf.default | 107 | 116 | 0.92:1 |
| AlertMinimalPerf.default | 191 | 209 | 0.91:1 |
| MenuButtonMinimalPerf.default | 1297 | 1419 | 0.91:1 |
| TooltipMinimalPerf.default | 854 | 937 | 0.91:1 |
| VideoMinimalPerf.default | 503 | 556 | 0.9:1 |
| TreeWith60ListItems.default | 122 | 138 | 0.88:1 |
| AvatarMinimalPerf.default | 141 | 162 | 0.87:1 |
| GridMinimalPerf.default | 245 | 293 | 0.84:1 |
| AccordionMinimalPerf.default | 102 | 127 | 0.8:1 |
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| BaseButton | mount | 683 | 697 | 5000 | |
| Breadcrumb | mount | 2213 | 2161 | 1000 | |
| Checkbox | mount | 1270 | 1174 | 5000 | |
| CheckboxBase | mount | 1039 | 1045 | 5000 | |
| ChoiceGroup | mount | 3591 | 3720 | 5000 | |
| ComboBox | mount | 776 | 819 | 1000 | |
| CommandBar | mount | 8590 | 8492 | 1000 | |
| ContextualMenu | mount | 9963 | 9791 | 1000 | |
| DefaultButton | mount | 895 | 940 | 5000 | |
| DetailsRow | mount | 3014 | 2994 | 5000 | |
| DetailsRowFast | mount | 3103 | 3046 | 5000 | |
| DetailsRowNoStyles | mount | 3097 | 2897 | 5000 | |
| Dialog | mount | 1857 | 1907 | 1000 | |
| DocumentCardTitle | mount | 144 | 141 | 1000 | |
| Dropdown | mount | 2757 | 2572 | 5000 | |
| FocusTrapZone | mount | 1474 | 1466 | 5000 | |
| FocusZone | mount | 1346 | 1451 | 5000 | |
| IconButton | mount | 1406 | 1349 | 5000 | |
| Label | mount | 303 | 271 | 5000 | |
| Layer | mount | 2350 | 2430 | 5000 | |
| Link | mount | 365 | 396 | 5000 | |
| MenuButton | mount | 1281 | 1144 | 5000 | |
| MessageBar | mount | 1757 | 1808 | 5000 | |
| Nav | mount | 2696 | 2543 | 1000 | |
| OverflowSet | mount | 908 | 949 | 5000 | |
| Panel | mount | 1709 | 1685 | 1000 | |
| Persona | mount | 814 | 769 | 1000 | |
| Pivot | mount | 1198 | 1218 | 1000 | |
| PrimaryButton | mount | 1011 | 1073 | 5000 | |
| Rating | mount | 6263 | 6316 | 5000 | |
| SearchBox | mount | 1098 | 1064 | 5000 | |
| Shimmer | mount | 1952 | 2132 | 5000 | |
| Slider | mount | 1498 | 1538 | 5000 | |
| SpinButton | mount | 4156 | 4023 | 5000 | |
| Spinner | mount | 377 | 342 | 5000 | |
| SplitButton | mount | 2616 | 2517 | 5000 | |
| Stack | mount | 406 | 395 | 5000 | |
| StackWithIntrinsicChildren | mount | 1829 | 1957 | 5000 | |
| StackWithTextChildren | mount | 4273 | 4171 | 5000 | |
| SwatchColorPicker | mount | 9456 | 9691 | 5000 | |
| TagPicker | mount | 2372 | 2296 | 5000 | |
| TeachingBubble | mount | 85579 | 82661 | 5000 | |
| Text | mount | 370 | 371 | 5000 | |
| TextField | mount | 1167 | 1133 | 5000 | |
| ThemeProvider | mount | 969 | 961 | 5000 | |
| ThemeProvider | virtual-rerender | 495 | 495 | 5000 | |
| ThemeProvider | virtual-rerender-with-unmount | 1607 | 1587 | 5000 | |
| Toggle | mount | 643 | 695 | 5000 | |
| buttonNative | mount | 106 | 107 | 5000 |
Co-authored-by: Sean Monahan <seanmonahan@microsoft.com>
…ling1726/fluentui into chore/eslint-ban-context-export
| } from './hooks/index'; | ||
|
|
||
| // eslint-disable-next-line @fluentui/ban-context-export | ||
| export { canUseDOM, defaultSSRContextValue, useIsSSR, useSSRContext, SSRContext, SSRProvider } from './ssr/index'; |
There was a problem hiding this comment.
| export { canUseDOM, defaultSSRContextValue, useIsSSR, useSSRContext, SSRContext, SSRProvider } from './ssr/index'; | |
| export { canUseDOM, defaultSSRContextValue, useIsSSR, useSSRContext, SSRProvider } from './ssr/index'; |
Well, we probably don't want to export SSRContext
There was a problem hiding this comment.
will do in a follow up PR, don't want to increase the scope right now
layershifter
left a comment
There was a problem hiding this comment.
Approving changes in packages (haven't checked the rule itself)
* fix: Syncpack after releasing v9 * chore: new eslint rule: `ban-context-export` This PR introduces a new eslint rule to ban exporting context objects from Fluent UI [you can read more detailed documentation here]() * changefile * improve variable name * test on CI * fix type * Update packages/eslint-plugin/src/rules/ban-context-export/index.js Co-authored-by: Sean Monahan <seanmonahan@microsoft.com> * fix ts * better message * exclude fixtures * add exclude option * fix syncpack * add ignore * changefile * add eslint ignore * changefile * rule should only apply to v9 * type aware rules for base Co-authored-by: Sean Monahan <seanmonahan@microsoft.com>
chore: new eslint rule: ban-context-export
This PR introduces a new eslint rule to ban exporting context objects
from Fluent UI you can read more detailed documentation here