Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button: Move to stricter lint rule for 40px size adherence #65840

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ module.exports = {
'BorderBoxControl',
'BorderControl',
'BoxControl',
'Button',
'ComboboxControl',
'CustomSelectControl',
'DimensionControl',
Expand All @@ -343,7 +344,7 @@ module.exports = {
selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"][value.expression.value!=false])):not(:has(JSXAttribute[name.name="size"][value.value!="default"]))`,
message:
componentName +
' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
' should have the `__next40pxDefaultSize` prop when using the default size.',
} ) ),
{
// Falsy `__next40pxDefaultSize` without a `render` prop.
Expand All @@ -352,14 +353,6 @@ module.exports = {
message:
'FormFileUpload should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
},
// Temporary rules until all existing components have the `__next40pxDefaultSize` prop.
...[ 'Button' ].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.',
} ) ),
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ function PostTemplateDropdownContent( { onClose } ) {
{ canEdit && onNavigateToEntityRecord && (
<p>
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
__next40pxDefaultSize
Copy link
Member Author

Choose a reason for hiding this comment

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

Activate a classic theme (e.g. Twenty Twelve) and open a page in the block editor.

Page template popover

No visible change because this is a link variant.

variant="link"
onClick={ () => {
onNavigateToEntityRecord( {
Expand Down
Loading