-
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
NumberControl: Add lint rule for 40px size prop usage #64561
Conversation
/** Start opting into the larger default height that will become the default size in a future version. */ | ||
__next40pxDefaultSize = false, |
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.
This was already being passed through via otherProps
, but making it explicit here. All in-app usage already uses the correct size.
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.
Thought: instead of exposing __next40pxDefaultSize
, could we instead just set __next40pxDefaultSize
to true
on NumberControl
? Or do we still care about offering consumers the option to opt-out of the new size, for the time being?
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.
I considered it, but checked third-party usage of some of these Typography controls and decided against it. They were used more than I thought, and some of them still use them in the old sizes, so decided against it.
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: +18 B (0%) Total Size: 1.77 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 🚀
/** Start opting into the larger default height that will become the default size in a future version. */ | ||
__next40pxDefaultSize = false, |
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.
Thought: instead of exposing __next40pxDefaultSize
, could we instead just set __next40pxDefaultSize
to true
on NumberControl
? Or do we still care about offering consumers the option to opt-out of the new size, for the time being?
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 🚀
LGTM 👍
It might be a good idea to add the prop to the component README. Right now, we're suggesting component usage that will trigger an ESLint error.
This is kind of nuanced, more than the margin bottom prop, because until the entire Gutenberg UI is converted to the new sizes, we can't really say to the public that they should convert the size of x component already. This was even more so when the sizes state of the Gutenberg UI was much more mixed than it is now. So I'm thinking of going in and documenting the prop on all the readmes (we're definitely ready for that now), but I don't want to put it as a default in the snippets until we start throwing deprecation warnings. And ideally that should happen all at once for all components in the system. |
Documented the prop on all relevant component READMEs in #64592 |
Part of #63871
What?
Add a lint rule to prevent people from introducing new usages of NumberControl that do not adhere to the new default size.
Testing Instructions
The lint error should trigger for violations as expected.