Skip to content

chore: new eslint rule ban-context-export#23141

Merged
ling1726 merged 21 commits into
microsoft:masterfrom
ling1726:chore/eslint-ban-context-export
May 25, 2022
Merged

chore: new eslint rule ban-context-export#23141
ling1726 merged 21 commits into
microsoft:masterfrom
ling1726:chore/eslint-ban-context-export

Conversation

@ling1726

Copy link
Copy Markdown
Contributor

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

ling1726 added 2 commits May 23, 2022 14:31
This PR introduces a new eslint rule to ban exporting context objects
from Fluent UI [you can read more detailed documentation here]()
@ling1726
ling1726 removed request for a team May 23, 2022 15:07
@ling1726

Copy link
Copy Markdown
Contributor Author

Once #23092 gets merged (it removes some already exported contexts) CI should be green

@codesandbox-ci

codesandbox-ci Bot commented May 23, 2022

Copy link
Copy Markdown

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:

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

@ling1726 ling1726 changed the title Chore/eslint ban context export chore: new eslint rule ban-context-export May 23, 2022
Comment thread packages/eslint-plugin/src/rules/ban-context-export/index.js Outdated
@fabricteam

fabricteam commented May 23, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

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

@size-auditor

size-auditor Bot commented May 23, 2022

Copy link
Copy Markdown

Asset size changes

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

Baseline commit: de233f964c22b5d61d40fca656762bad66f77f6b (build)

@fabricteam

fabricteam commented May 23, 2022

Copy link
Copy Markdown
Collaborator

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
priority-overflow
createOverflowManager
2.936 kB
1.212 kB
react-accordion
Accordion (including children components)
74.251 kB
22.683 kB
react-avatar
Avatar
45.588 kB
13.32 kB
react-badge
Badge
20.985 kB
6.62 kB
react-badge
CounterBadge
21.898 kB
6.925 kB
react-badge
PresenceBadge
22.21 kB
6.672 kB
react-button
Button
32.927 kB
9.036 kB
react-button
CompoundButton
39.854 kB
10.26 kB
react-button
MenuButton
35.11 kB
9.783 kB
react-button
SplitButton
42.369 kB
11.085 kB
react-button
ToggleButton
47.52 kB
10.603 kB
react-card
Card - All
60.746 kB
17.41 kB
react-card
Card
56.031 kB
16.147 kB
react-card
CardFooter
7.793 kB
3.327 kB
react-card
CardHeader
9.363 kB
3.841 kB
react-card
CardPreview
7.765 kB
3.35 kB
react-combobox
Combobox
61.412 kB
20.982 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
181.156 kB
50.603 kB
react-components
react-components: FluentProvider & webLightTheme
34.078 kB
11.098 kB
react-divider
Divider
15.55 kB
5.595 kB
react-image
Image
10.012 kB
3.982 kB
react-input
Input
22.163 kB
7.295 kB
react-label
Label
8.546 kB
3.574 kB
react-link
Link
11.422 kB
4.648 kB
react-menu
Menu (including children components)
111.638 kB
34.054 kB
react-menu
Menu (including selectable components)
114.813 kB
34.527 kB
react-overflow
hooks only
10.792 kB
4.124 kB
react-popover
Popover
103.74 kB
31.544 kB
react-portal
Portal
6.272 kB
2.17 kB
react-positioning
usePositioning
23.828 kB
8.283 kB
react-provider
FluentProvider
14.127 kB
5.299 kB
react-radio
Radio
29.483 kB
10.098 kB
react-radio
RadioGroup
13.664 kB
5.486 kB
react-select
Select
17.138 kB
6.367 kB
react-slider
Slider
25.557 kB
8.266 kB
react-spinbutton
SpinButton
42.132 kB
11.895 kB
react-spinner
Spinner
18.158 kB
6.029 kB
react-switch
Switch
25.439 kB
8.247 kB
react-text
Text - Default
10.904 kB
4.298 kB
react-text
Text - Wrappers
14.226 kB
4.714 kB
react-textarea
Textarea
21.207 kB
7.165 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
31.363 kB
7.043 kB
react-theme
Teams: Light theme
19.806 kB
5.699 kB
react-tooltip
Tooltip
43.584 kB
14.992 kB
react-utilities
SSRProvider
189 B
161 B
🤖 This report was generated against 2c84c4f1ad43819325ee0aafa57d42a1f8239113

@fabricteam

fabricteam commented May 23, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
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

@fabricteam

fabricteam commented May 23, 2022

Copy link
Copy Markdown
Collaborator

Perf Analysis (@fluentui/react)

No significant results to display.

All results

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

@ling1726
ling1726 requested a review from a team as a code owner May 24, 2022 19:16
} from './hooks/index';

// eslint-disable-next-line @fluentui/ban-context-export
export { canUseDOM, defaultSSRContextValue, useIsSSR, useSSRContext, SSRContext, SSRProvider } from './ssr/index';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will do in a follow up PR, don't want to increase the scope right now

@layershifter layershifter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving changes in packages (haven't checked the rule itself)

@ling1726
ling1726 enabled auto-merge (squash) May 25, 2022 08:26
@ling1726
ling1726 merged commit fff6a01 into microsoft:master May 25, 2022
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants