-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Add lint rule for 40px size prop usage #64835
Conversation
@@ -148,13 +148,21 @@ export const actions = [ | |||
return ( | |||
<VStack spacing="5"> | |||
<Text> | |||
{ `Are you sure you want to delete "${ item.title }"?` } | |||
{ `Are you sure you want to delete "${ item?.title }"?` } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the report! I've prepared a fix at #64901
@@ -37,6 +42,7 @@ const TestURLPopover = () => { | |||
<form onSubmit={ close }> | |||
<input type="url" value={ url } onChange={ setUrl } /> | |||
<Button | |||
__next40pxDefaultSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😞 we could try to propose a fix if it's a quick one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem quick, but maybe something that can be fixed in conjunction with #64709.
@@ -58,7 +58,9 @@ describe( 'withDispatch', () => { | |||
} ); | |||
}, | |||
}; | |||
} )( ( props ) => <Button onClick={ props.increment } /> ); | |||
} )( ( props ) => ( | |||
<Button __next40pxDefaultSize onClick={ props.increment } /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't matter because this is a test.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +363 B (+0.02%) Total Size: 1.78 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
This PR is a reminder about why we're so cautious when dealing with Button
😅 So many usages!
* Fix in URLPopover story * Fix in Dataviews story * Fix in WithDispatch test * Add todo comments * Add lint rule Co-authored-by: mirka <[email protected]> Co-authored-by: ciampo <[email protected]>
Part of #63871
What?
Add a lint rule to prevent people from introducing new usages of Button that do not adhere to the new default size, while adding a TODO note on existing violations.
I also went ahead and fixed the three straightforward ones (tests and stories).
Why?
Some components have a large number of existing violations, and it would take some time to safely switch them all. We can more efficiently move everything to the new 40px sizes if we immediately start preventing new violations from entering the codebase, as well as add TODO comments on the existing violations so people who come across that code are more likely to fix it on the spot.
How?
I codemod'ed all existing violations to:
Testing Instructions
The lint error should trigger if you add a Button with no
__next40pxDefaultSize
orsize
prop.