Repository navigation
Conversation
|
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! |
9da7b22 to
846e88f
Compare
| "H2": "Use `Text` with `variant=\"heading-*\"` from `@wordpress/ui` instead.", | ||
| "H3": "Use `Text` with `variant=\"heading-*\"` from `@wordpress/ui` instead.", |
| "Testimonials": "Jetpack-specific component — remove from denylist to allow.", | ||
| "Text": "Use `Text` from `@wordpress/ui` instead.", | ||
| "ThemeProvider": "Use `@wordpress/theme` instead.", | ||
| "Title": "Use `Text` from `@wordpress/ui` instead.", |
770e765 to
00583fd
Compare
4ecda18 to
a3f1327
Compare
anomiex
left a comment
There was a problem hiding this comment.
Partial review: I didn't look at the code yet, just the structure being added.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
…nded-jetpack-components.test.cjs Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
da7fedd to
079abc4
Compare
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
keoshi
left a comment
There was a problem hiding this comment.
LGTM! Thanks for doing this!
One question: will this trigger warnings for all current gaps, or only when being touched? I'm concerned with the particular case of Col, which was created for a very specific purpose but not applicable today.
References:
- https://automattic.github.io/jetpack-storybook/?path=/story/js-packages-components-layout--default
- PbJqbW-7N-p2
Seems like there's not a ton left behind, but wanted to clarify that just so I understand the immediate consequences.
| "private": true, | ||
| "description": "Avoid cluttering the monorepo root with random JS script deps by putting them in a workspace. This is intended for simple scripts and third-party scripts that we will only run directly or from the monorepo root.", | ||
| "scripts": { | ||
| "test-eslint-plugin-jetpack": "node eslint-plugin-jetpack/tests/use-recommended-jetpack-components.test.mjs" |
There was a problem hiding this comment.
I note this isn't hooked up to be run in CI anywhere.
What you'd probably want is to add it into the list at
Lines 71 to 73 in 079abc4
| import { RuleTester } from 'eslint'; | ||
| import rule from '../rules/use-recommended-jetpack-components.mjs'; | ||
|
|
||
| const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); |
There was a problem hiding this comment.
| const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); | |
| const __dirname = import.meta.dirname; |
Or just use that directly later.
| '..', | ||
| '..', | ||
| '..', | ||
| 'eslint', | ||
| 'jetpack-components-denylist.json' |
There was a problem hiding this comment.
Any particular reason not to just do
| '..', | |
| '..', | |
| '..', | |
| 'eslint', | |
| 'jetpack-components-denylist.json' | |
| '../../../eslint/jetpack-components-denylist.json' |
?
| import path from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
|
|
||
| const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); |
There was a problem hiding this comment.
| const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); | |
| const __dirname = import.meta.dirname; |
Or just use that directly later.
| '..', | ||
| '..', | ||
| '..', | ||
| 'eslint', | ||
| 'jetpack-components-denylist.json' |
There was a problem hiding this comment.
Any particular reason not to just do
| '..', | |
| '..', | |
| '..', | |
| 'eslint', | |
| 'jetpack-components-denylist.json' | |
| '../../../eslint/jetpack-components-denylist.json' |
?
Also, I wonder why you don't move the file into the eslint-plugin-jetpack dir instead of having it at a completely different path.
| const jetpackComponentsDenylistPath = path.join( | ||
| rootdir, | ||
| 'tools/eslint/jetpack-components-denylist.json' | ||
| ); |
There was a problem hiding this comment.
Why not just let the rule use its default, which should be pointing to the exact same file?
|
This PR has been marked as stale. This happened because:
If this PR is still useful, please do a [trunk merge or rebase](https://github.com/Automattic/jetpack/blob/trunk/docs/git-workflow.md#keeping-your-branch-up-to-date) and otherwise make sure it's up to date and has clear testing instructions. You may also want to ping possible reviewers in case they've forgotten about it. Please close this PR if you think it's not valid anymore — if you do, please add a brief explanation. If the PR is not updated (or at least commented on) in another month, it will be automatically closed. |
|
This PR has been automatically closed as it has not been updated in some time. If you want to resume work on the PR, feel free to restore the branch and reopen the PR. |
Pairs with #48487 where we direct folks to use
@wordpress/uiinstead of@wordpress/componentlibrary.Proposed changes
As part of modernising componentry, there are plenty of duplicates in Jetpack primitive componentry that aren't justified, as we can just use
@wordpress/uior@wordpress/componentsinstead.The eslint rule discourages new_ usage of select Jetpack components & primitives; we list the current offending files in the exceptions list.
The list of Jetpack components here is a preliminary list, and can be extended later to include more Jetpack components.
In the denylist
These will trigger
@automattic/jetpack/use-recommended-jetpack-components:Alert@wordpress/uiNoticeButton@wordpress/uiButtonChip@wordpress/uiBadgeCol@wordpress/uiStackContainer@wordpress/uiStackDecorativeCard@wordpress/uiCardDialog@wordpress/uiDialogDonutMeter@automattic/chartsPieChartGlobalNotices@wordpress/noticesglobalNoticesStore@wordpress/noticesH2@wordpress/uiText(heading variant)H3@wordpress/uiText(heading variant)IconTooltip@wordpress/uiTooltip+IconIndeterminateProgressBar@wordpress/componentsSpinner/ProgressBarNavigatorModal@wordpress/uiDialog+@wordpress/componentsNavigatorNotice@wordpress/uiNoticeNumberControl@wordpress/components__experimentalNumberControlNumberSlider@wordpress/componentsRangeControlPopover@wordpress/uiPopoverProgressBar@wordpress/componentsProgressBar/SpinnerRadioControl@wordpress/componentsRadioControlSpinner@wordpress/componentsSpinnerSplitButton@wordpress/uiButton(+Dropdownif needed)Status@wordpress/uiBadgeText@wordpress/uiTextTitle@wordpress/uiTextToggleControl@wordpress/componentsToggleControluseBreakpointMatch@wordpress/viewportuseGlobalNotices@wordpress/noticesSubpath imports also flagged:
@automattic/jetpack-components/button@automattic/jetpack-components/global-noticesNot in the denylist (allowed by this rule)
These exports from
@automattic/jetpack-componentsare not flagged:Branding / logos
JetpackLogo,JetpackSearchLogo,JetpackProtectLogo,JetpackVaultPressBackupLogo,JetpackVideoPressLogoAutomatticBylineLogo,AutomatticIconLogo,AutomatticForAgenciesLogoJetpackFooterJetpack-specific UI
ActionButton,ActionPopoverAdminPage,AdminSection,AdminSectionHeroBoostScoreBar,BoostScoreGraphContextualUpgradeTriggerCopyToClipboardDetailsViewer,DiffViewer,MarkedLinesDotPager,DonutMeteris in denylist - skipLoadingPlaceholderPricingCard,PricingTable,PricingTableColumn,PricingTableHeader,PricingTableItemProductOffer,IconsCard,ProductPriceQRCodeRecordMeterBarStatCardTestimonials,TermsOfServiceUpsellBannerZendeskChatGravatarThemeProviderIcons (all allowed)
AntiSpamIcon,BackupIcon,BoostIcon,CrmIcon,ExtrasIcon,ProtectIcon,ScanIcon,SearchIcon,SocialIcon,VideopressIcon,StarIcon,CheckmarkIcon,ClipboardIcon,JetpackIcon,ShareIcon,AiIcon,StatsIcon,SocialServiceIcongetIconBySlug, plus related typesUtilities / helpers
getRedirectUrl,getProductCheckoutUrl,isFirstMonthTrialgetUserLocale,cleanLocaleTypes only (not typically linted as imports)
ButtonProps,GravatarProps, icon-related typesRelated product discussion/links
Does this pull request change what data or activity we track or use?
Testing instructions