Add eslint-plugin-jsdoc to check jsdoc comments#19271
Conversation
| tagNamePreference: { | ||
| defaultvalue: 'defaultvalue', | ||
| defaultValue: 'defaultValue', | ||
| return: 'return', | ||
| }, |
There was a problem hiding this comment.
These are temporary and will be removed in a future PR. I wanted to scope this PR to adding the new plugin, and a future PR to fix places that use @defaultvalue
There was a problem hiding this comment.
can we move to this to generic config ? every platform should use same conventions (node/web)
There was a problem hiding this comment.
Right now the node config actually extends from this one and just turns off no-console (which is maybe not great, but a separate problem)
| "comment": "Add eslint-plugin-jsdoc to check for jsdoc errors", | ||
| "packageName": "@fluentui/eslint-plugin", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "none" |
There was a problem hiding this comment.
Note I changed this to none, per https://github.com/microsoft/fluentui/pull/19169/files#r681520686
There was a problem hiding this comment.
great catch @behowell !
@ecraig12345 do we need to publish this package at all? who consumes this outside our org ?
if we make it private then we can mitigate such a chore that happened last time with releases.
WDYT?
There was a problem hiding this comment.
IIRC I originally made it public because some of the custom rules (outlined in the readme) might be useful to others. But I have no way to know if anybody else has actually found and used them.
|
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 b6493d3:
|
Perf Analysis (
|
| Scenario | Render type | Master Ticks | PR Ticks | Iterations | Status |
|---|---|---|---|---|---|
| Avatar | mount | 965 | 1011 | 5000 | |
| BaseButton | mount | 969 | 962 | 5000 | |
| Breadcrumb | mount | 2639 | 2599 | 1000 | |
| ButtonNext | mount | 468 | 447 | 5000 | |
| Checkbox | mount | 1714 | 1648 | 5000 | |
| CheckboxBase | mount | 1430 | 1416 | 5000 | |
| ChoiceGroup | mount | 5153 | 5082 | 5000 | |
| ComboBox | mount | 1006 | 1012 | 1000 | |
| CommandBar | mount | 10543 | 10863 | 1000 | |
| ContextualMenu | mount | 6483 | 6287 | 1000 | |
| DefaultButton | mount | 1233 | 1243 | 5000 | |
| DetailsRow | mount | 3909 | 3996 | 5000 | |
| DetailsRowFast | mount | 3973 | 3936 | 5000 | |
| DetailsRowNoStyles | mount | 3669 | 3806 | 5000 | |
| Dialog | mount | 2399 | 2249 | 1000 | |
| DocumentCardTitle | mount | 165 | 161 | 1000 | |
| Dropdown | mount | 3619 | 3612 | 5000 | |
| FluentProviderNext | mount | 7204 | 7378 | 5000 | |
| FocusTrapZone | mount | 1883 | 1858 | 5000 | |
| FocusZone | mount | 1871 | 1850 | 5000 | |
| IconButton | mount | 2186 | 1944 | 5000 | |
| Label | mount | 361 | 355 | 5000 | |
| Layer | mount | 1867 | 1848 | 5000 | |
| Link | mount | 492 | 486 | 5000 | |
| MakeStyles | mount | 1842 | 1895 | 50000 | |
| MenuButton | mount | 1556 | 1587 | 5000 | |
| MessageBar | mount | 2060 | 2122 | 5000 | |
| Nav | mount | 3515 | 3423 | 1000 | |
| OverflowSet | mount | 1184 | 1134 | 5000 | |
| Panel | mount | 2120 | 2141 | 1000 | |
| Persona | mount | 865 | 888 | 1000 | |
| Pivot | mount | 1575 | 1465 | 1000 | |
| PrimaryButton | mount | 1353 | 1380 | 5000 | |
| Rating | mount | 8415 | 8459 | 5000 | |
| SearchBox | mount | 1444 | 1506 | 5000 | |
| Shimmer | mount | 2779 | 2714 | 5000 | |
| Slider | mount | 2033 | 2071 | 5000 | |
| SpinButton | mount | 5297 | 5262 | 5000 | |
| Spinner | mount | 432 | 438 | 5000 | |
| SplitButton | mount | 3359 | 3324 | 5000 | |
| Stack | mount | 529 | 533 | 5000 | |
| StackWithIntrinsicChildren | mount | 1693 | 1656 | 5000 | |
| StackWithTextChildren | mount | 5015 | 5082 | 5000 | |
| SwatchColorPicker | mount | 11034 | 11047 | 5000 | |
| Tabs | mount | 1481 | 1499 | 1000 | |
| TagPicker | mount | 2760 | 2865 | 5000 | |
| TeachingBubble | mount | 12468 | 12665 | 5000 | |
| Text | mount | 442 | 454 | 5000 | |
| TextField | mount | 1497 | 1502 | 5000 | |
| ThemeProvider | mount | 1291 | 1313 | 5000 | |
| ThemeProvider | virtual-rerender | 658 | 657 | 5000 | |
| Toggle | mount | 882 | 909 | 5000 | |
| buttonNative | mount | 114 | 120 | 5000 |
Perf Analysis (@fluentui/react-northstar)
Perf tests with no regressions
| Scenario | Current PR Ticks | Baseline Ticks | Ratio |
|---|---|---|---|
| ButtonMinimalPerf.default | 198 | 176 | 1.13:1 |
| CarouselMinimalPerf.default | 530 | 487 | 1.09:1 |
| DividerMinimalPerf.default | 404 | 369 | 1.09:1 |
| PopupMinimalPerf.default | 648 | 598 | 1.08:1 |
| AttachmentMinimalPerf.default | 181 | 169 | 1.07:1 |
| ChatMinimalPerf.default | 739 | 696 | 1.06:1 |
| GridMinimalPerf.default | 373 | 354 | 1.05:1 |
| TooltipMinimalPerf.default | 1149 | 1097 | 1.05:1 |
| AnimationMinimalPerf.default | 443 | 428 | 1.04:1 |
| LayoutMinimalPerf.default | 429 | 412 | 1.04:1 |
| PortalMinimalPerf.default | 173 | 167 | 1.04:1 |
| ReactionMinimalPerf.default | 418 | 403 | 1.04:1 |
| SkeletonMinimalPerf.default | 378 | 364 | 1.04:1 |
| StatusMinimalPerf.default | 793 | 764 | 1.04:1 |
| TextMinimalPerf.default | 378 | 364 | 1.04:1 |
| AttachmentSlotsPerf.default | 1187 | 1149 | 1.03:1 |
| AvatarMinimalPerf.default | 207 | 200 | 1.03:1 |
| BoxMinimalPerf.default | 371 | 359 | 1.03:1 |
| HeaderSlotsPerf.default | 844 | 823 | 1.03:1 |
| ListMinimalPerf.default | 567 | 550 | 1.03:1 |
| MenuMinimalPerf.default | 912 | 889 | 1.03:1 |
| ProviderMinimalPerf.default | 1087 | 1057 | 1.03:1 |
| TableManyItemsPerf.default | 2151 | 2093 | 1.03:1 |
| ToolbarMinimalPerf.default | 1099 | 1067 | 1.03:1 |
| ButtonOverridesMissPerf.default | 1835 | 1795 | 1.02:1 |
| DatepickerMinimalPerf.default | 5876 | 5747 | 1.02:1 |
| DropdownManyItemsPerf.default | 738 | 723 | 1.02:1 |
| EmbedMinimalPerf.default | 4438 | 4369 | 1.02:1 |
| FormMinimalPerf.default | 462 | 455 | 1.02:1 |
| HeaderMinimalPerf.default | 393 | 386 | 1.02:1 |
| SliderMinimalPerf.default | 1656 | 1628 | 1.02:1 |
| TableMinimalPerf.default | 438 | 428 | 1.02:1 |
| TextAreaMinimalPerf.default | 551 | 541 | 1.02:1 |
| ImageMinimalPerf.default | 421 | 418 | 1.01:1 |
| ItemLayoutMinimalPerf.default | 1364 | 1350 | 1.01:1 |
| ListCommonPerf.default | 732 | 723 | 1.01:1 |
| ListNestedPerf.default | 611 | 606 | 1.01:1 |
| ListWith60ListItems.default | 698 | 690 | 1.01:1 |
| LoaderMinimalPerf.default | 725 | 715 | 1.01:1 |
| RadioGroupMinimalPerf.default | 476 | 473 | 1.01:1 |
| SegmentMinimalPerf.default | 376 | 372 | 1.01:1 |
| CardMinimalPerf.default | 604 | 607 | 1:1 |
| CheckboxMinimalPerf.default | 2823 | 2834 | 1:1 |
| RefMinimalPerf.default | 237 | 236 | 1:1 |
| TreeMinimalPerf.default | 842 | 844 | 1:1 |
| VideoMinimalPerf.default | 682 | 684 | 1:1 |
| ButtonSlotsPerf.default | 589 | 596 | 0.99:1 |
| ChatDuplicateMessagesPerf.default | 298 | 301 | 0.99:1 |
| DialogMinimalPerf.default | 820 | 832 | 0.99:1 |
| LabelMinimalPerf.default | 466 | 469 | 0.99:1 |
| ProviderMergeThemesPerf.default | 1675 | 1695 | 0.99:1 |
| SplitButtonMinimalPerf.default | 4150 | 4185 | 0.99:1 |
| IconMinimalPerf.default | 671 | 678 | 0.99:1 |
| CustomToolbarPrototype.default | 4052 | 4087 | 0.99:1 |
| AccordionMinimalPerf.default | 170 | 173 | 0.98:1 |
| AlertMinimalPerf.default | 297 | 304 | 0.98:1 |
| ChatWithPopoverPerf.default | 387 | 395 | 0.98:1 |
| DropdownMinimalPerf.default | 3186 | 3235 | 0.98:1 |
| FlexMinimalPerf.default | 309 | 314 | 0.98:1 |
| RosterPerf.default | 1302 | 1331 | 0.98:1 |
| MenuButtonMinimalPerf.default | 1799 | 1864 | 0.97:1 |
| InputMinimalPerf.default | 1329 | 1378 | 0.96:1 |
| TreeWith60ListItems.default | 190 | 216 | 0.88:1 |
as briefly discussed in your previous PR, I'd say this should be discussed with vbuild - which way we wanna go ( API extractor or not api extractor for docs ? -> and with that TSDoc or JSDoc )
|
Hotell
left a comment
There was a problem hiding this comment.
going to block this for now - reasoning: should be discussed with vBuild team/broader team probably
| 'import/namespace': 'off', | ||
| 'import/no-named-as-default-member': 'off', | ||
|
|
||
| 'jsdoc/check-tag-names': ['error', { definedTags: ['jest-environment'] }], |
There was a problem hiding this comment.
I'd remove that definedTags and instead turn off that rule in particular file - this is rather an edge case - a good practice is not to generalise on edge cases from my experience
| 'import/namespace': 'off', | ||
| 'import/no-named-as-default-member': 'off', | ||
|
|
||
| 'jsdoc/check-tag-names': ['error', { definedTags: ['jest-environment'] }], |
There was a problem hiding this comment.
this is a topic to be discussed at vbuild sync, but I'd propose to use severity warn - lint violation is not inflicting any critical issues to runtime code - thus should not break build etc.
In general our DX is a big red squiggles ocean (for non critical violations) which is from my experience (based on feedback of big teams) very distracting.
There was a problem hiding this comment.
In my experience, warnings never get fixed and just clutter up the build output. If you have warnings checked into master, then people learn to ignore warnings (and new ones get buried in the sea of warnings that other people haven't fixed). I'd say it's not worth adding this at all unless it's an error.
There was a problem hiding this comment.
What @behowell said is generally what I've also said when we discussed this in the past. It seems like a fundamental philosophical difference about the purpose of linting, which I'm not sure how to resolve.
There was a problem hiding this comment.
In my experience, warnings never get fixed and just clutter up the build output. If you have warnings checked into master, then people learn to ignore warnings (and new ones get buried in the sea of warnings that other people haven't fixed). I'd say it's not worth adding this at all unless it's an error.
everyone has different experience for sure :) IF you have solid CI DX (integrated into review - eg github action) and rule sets (to fail pipeline if there is a threshold reached of lint warnings), it is very nicely doable (implemented this for 100 dev org and it worked very nicely)
There was a problem hiding this comment.
I'll try to prepare an RFC with setup that I'd propose going forward based on my experience in this field, where we can discuss things further. appreciate your opinions ✌️
@Hotell is the discussion with v-build about whether to use the jsdoc lint plugin at all? Or the specifics of whether we want |
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 8078e6915b4e74a3e1d2d53f6ff7198fd9dc2631 (build) |
📊 Bundle size reportUnchanged fixtures
|
the discussion should be about
Based on that decision appropriate linting rules should be added |
|
We had additional discussion with build team today with following outcomes:
thank you for your patience 🙌 |
ecraig12345
left a comment
There was a problem hiding this comment.
LGTM once the change types are fixed
|
🎉 Handy links: |
Pull request checklist
$ yarn changeDescription of changes
This change adds the jsdoc plugin for eslint. For now, only the
check-tag-namesrule is enabled, and temporarytagNamePreferencevalues are added to avoid causing errors yet. In a future PR, I plan to update the config to require@defaultinstead of@defaultvalue, and@returnsinstead of@return.See #18566 (comment) for reference about plans to change
@defaultvalueto@default