Skip to content

Commit

Permalink
Button: Move to stricter lint rule for 40px size adherence (WordPress…
Browse files Browse the repository at this point in the history
…#65840)

* Fix last remaining instance

* Button: Move to stricter lint rule

* Tweak wording to account for `size` variants

Co-authored-by: mirka <[email protected]>
Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
4 people authored and karthick-murugan committed Nov 13, 2024
1 parent 3527a6f commit 6a57e44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
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
variant="link"
onClick={ () => {
onNavigateToEntityRecord( {
Expand Down

0 comments on commit 6a57e44

Please sign in to comment.