From 771e50878bc46dcbb040250d7b43359c3c49b983 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Sat, 10 Aug 2024 09:26:13 +0900 Subject: [PATCH 1/3] TextControl: Add lint rule for 40px size prop usage --- .eslintrc.js | 8 ++++++++ .../src/components/date-format-picker/index.js | 2 ++ .../src/components/media-upload/index.native.js | 2 ++ .../src/components/url-popover/image-url-input-ui.js | 4 ++++ packages/block-library/src/button/edit.js | 2 ++ packages/block-library/src/form-input/edit.js | 2 ++ packages/block-library/src/form/edit.js | 2 ++ packages/block-library/src/image/image.js | 2 ++ .../src/navigation/edit/navigation-menu-name-control.js | 2 ++ packages/block-library/src/post-comment/edit.js | 2 ++ packages/block-library/src/post-featured-image/edit.js | 2 ++ packages/block-library/src/post-terms/edit.js | 2 ++ packages/block-library/src/post-title/edit.js | 2 ++ packages/block-library/src/social-link/edit.js | 4 ++++ .../src/template-part/edit/advanced-controls.js | 2 ++ packages/block-library/src/video/tracks-editor.js | 4 ++++ .../src/components/sidebar-dataviews/add-new-view.js | 2 ++ .../components/sidebar-dataviews/custom-dataviews-list.js | 2 ++ .../src/components/post-publish-panel/postpublish.js | 2 ++ packages/editor/src/components/post-slug/index.js | 2 ++ .../post-taxonomies/hierarchical-term-selector.js | 2 ++ .../reusable-block-convert-button.js | 2 ++ 22 files changed, 56 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index cb669fb4177206..068cf66c3ac370 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -308,6 +308,14 @@ module.exports = { componentName + ' should have the `__nextHasNoMarginBottom` prop to opt-in to the new margin-free styles.', } ) ), + // Temporary rules until all existing components have the `__next40pxDefaultSize` prop. + ...[ 'TextControl' ].map( ( componentName ) => ( { + // Not strict. Allows pre-existing __next40pxDefaultSize={ false } usage until they are all manually updated. + selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"])):not(:has(JSXAttribute[name.name="size"]))`, + message: + componentName + + ' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.', + } ) ), ], }, }, diff --git a/packages/block-editor/src/components/date-format-picker/index.js b/packages/block-editor/src/components/date-format-picker/index.js index 15beec4ac6ed54..63c977b111e01c 100644 --- a/packages/block-editor/src/components/date-format-picker/index.js +++ b/packages/block-editor/src/components/date-format-picker/index.js @@ -149,6 +149,8 @@ function NonDefaultControls( { format, onChange } ) { /> { isCustom && ( { isLinkTag && ( { ) } /> ( diff --git a/packages/block-library/src/post-featured-image/edit.js b/packages/block-library/src/post-featured-image/edit.js index c9f4645e5e8654..675580c71c1d7b 100644 --- a/packages/block-library/src/post-featured-image/edit.js +++ b/packages/block-library/src/post-featured-image/edit.js @@ -230,6 +230,8 @@ export default function PostFeaturedImageEdit( { checked={ linkTarget === '_blank' } /> onChange( { diff --git a/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js b/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js index aabb49c14a2ff7..69cca49fd84563 100644 --- a/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js +++ b/packages/edit-site/src/components/sidebar-dataviews/add-new-view.js @@ -78,6 +78,8 @@ function AddNewItemModalContent( { type, setIsAdding } ) { >
{ showFilter && ( Date: Wed, 14 Aug 2024 05:49:58 +0900 Subject: [PATCH 2/3] Fixup --- .eslintrc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 66fc686c55313d..d1edc2d4de82f2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -309,7 +309,6 @@ module.exports = { componentName + ' should have the `__nextHasNoMarginBottom` prop to opt-in to the new margin-free styles.', } ) ), - // Temporary rules until we're ready to officially default to the new size. ...[ 'BorderBoxControl', From 02515e4e86802b4c9c520ac5bd104a2e4f533e2a Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 14 Aug 2024 05:57:25 +0900 Subject: [PATCH 3/3] Fixup formatting --- .eslintrc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d1edc2d4de82f2..eb2d2db47e4cab 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -326,10 +326,10 @@ module.exports = { ...[ 'TextControl' ].map( ( componentName ) => ( { // Not strict. Allows pre-existing __next40pxDefaultSize={ false } usage until they are all manually updated. selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"])):not(:has(JSXAttribute[name.name="size"]))`, - message: + message: componentName + ' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.', - } ) ), + } ) ), ], }, },