Repository navigation
Conversation
@wordpress/use-recommended-components
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Boost plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Starter Plugin plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Protect plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Videopress plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Automattic For agencies client plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Classic Theme helper plugin plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Paypal Payment buttons plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
tbradsha
left a comment
There was a problem hiding this comment.
I haven't done a deep code review, but any reason we're not just cleaning these up directly? Looks like ~250 instances in the suppressions file, and I suspect many of them are the same or similar instances. Could one throw AI at it?
I'd at least recommend trying a cleanup of violations/merge into trunk before adding this.
Also, if I'm skimming correctly, it seems that once a file has suppressed errors of the given type, it won't prevent additional such errors from being added to a file.
My fear is that we'll end up with an additional layer of complexity that only serves to suppress issues we haven't properly fixed.
That's not trivial as these aren't mere code-formatting lints; code change would be simple'ish, but each component swap usually needs some design decisions and, of course, lots of testing that things continue working, which is a lot of work. There are four folks replacing old components right now with Note that Gutenberg is using an identical strategy to change their components. |
We definitely appreciate the cleanup/modernization efforts! I totally get this, having dealt with Phan cleanup (which uses baselines) and Stylelint (no baselines but rule-by-rule cleanup). We have the same goal, so let's see if we can align on implementation. :^) Some thoughts:
|
|
As an aside, it seems If it's noise/interfering with your current work, feel free to close it. 😄 I also notice you put up a similar PR targeting just Forms here: #48407 |
|
Feel free to open an issue in Gutenberg to discuss / agree on improvements to |
Added here: WordPress/gutenberg#78062 |
482b6b5 to
af67d45
Compare
ba3becb to
593d7a8
Compare
@wordpress/use-recommended-components@wordpress/use-recommended-components
6708e8b to
213df3c
Compare
|
@anomiex I've updated the PR to use the existing custom FYI, current failures in the lint job are known and described in the PR description. I'm still working on those aspects. Can you clarify a couple of developer experience nuances just so that I understand correctly how the custom Jetpack Eslint workflow works, vs the regular Eslint functionality:
|
|
The new |
|
Looks like it could use a rebase onto the current version of #53004. Beyond that, my earlier comment still holds for me:
|
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Depends on #53004
Proposed changes
Enables
@wordpress/use-recommended-componentswithallowUseWithCaution: truesetting as anerror-level ESLint rule monorepo-wide (intools/js-tools/eslintrc/base.mjs). This encourages migration away from deprecated or experimental@wordpress/componentsexports toward stable@wordpress/uicomponents, and allows early-adopting some of the new "use with caution" components.Existing violations are tracked in
tools/eslint-excludelist.json, using the monorepo's existing@automattic/eslint-changedworkflow.Every current usage of
@wordpress/uiin Jetpack is on the allowlist.Allowed @wordpress/ui
The
use-recommended-componentsrule does not allowlist@wordpress/components. Any import from that package is allowed unless it is on the denylist below. The allowlist is@wordpress/ui. These lists are from Gutenberg trunk, which is ahead of the published@wordpress/eslint-plugin27.0.0.Allowed
@wordpress/uiThese pass with no option set:
Autocomplete,Badge,Calendar,Card,Checkbox,CheckboxControl,CheckboxGroup,Collapsible,CollapsibleCard,ControlWithError,EmptyState,Field,Fieldset,Icon,Input,InputControl,InputLayout,KeyboardShortcutDescription,KeyboardShortcutDisplay,Link,Notice,Progress,Radio,RadioGroup,RadioGroupControl,RangeCalendar,SearchableChipSelect,SearchableChipSelectControl,Select,SelectControl,Skeleton,Spinner,Stack,Switch,SwitchControl,Tabs,Text,Textarea,TextareaControl,Tooltip,ValidatedInputControl,ValidatedTextareaControl,ValidityIndicator,VisuallyHidden,useKeyboardShortcutPropsAllowed due to
allowUseWithCaution: trueAlertDialog,Breadcrumb,Button,ButtonLink,Combobox,Dialog,Drawer,IconButton,Menu,Meter,Popover,SearchableSelect,SearchableSelectControlDisallowed
@wordpress/componentsRelated product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Verify the rule is active:
ExternalLinkfrom@wordpress/components— ESLint should report an error: "UseLinkfrom@wordpress/uiwith theopenInNewTabprop instead."tools/eslint-excludelist.json(e.g.projects/js-packages/components/components/admin-page/index.tsx) — the existing violation should be silently suppressed andpnpm run lint-file <file>should exit 0.