ESLint: Restrict deprecated __nextHasNoMarginBottom prop#78579
Conversation
|
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: -25 B (0%) Total Size: 8.04 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in d561f53. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26293476241
|
aduth
left a comment
There was a problem hiding this comment.
Makes sense 👍 But I'm still unclear at what point we can remove all traces of this prop from the code. If it wasn't in the TypeScript types, we could rely on type-checking instead. With recent discussions, I'm still not clear why we keep these types. It feels like a reasonable change that downstream consumers would want to be informed is no longer part of the API and remove accordingly when they update their package reference, and importantly removing the type doesn't break existing runtime usage.
|
Here's the thread of how this came to be, if you're interested 😄 |
What?
Adds an ESLint
no-restricted-syntaxrule to disallow the__nextHasNoMarginBottomJSX prop, and removes existing usages.Why?
Margin-free styles are now the default for the affected
@wordpress/componentscontrols, so the opt-in prop is redundant. However, I've noticed a recent uptick (for example here) in new code including this prop — apparently agents are doing this even without any code snippets or guidance in the codebase to do so.Let's restrict this with a lint to keep the codebase clean. We should also do this for the
__next40pxDefaultSizeprop that we will be removing soon for WP 7.1.How?
JSXAttributeselector to the sharedrestrictedSyntaxlist intools/eslint/config.mjs.Testing Instructions
npm run lint:js(or lint one of the touched files) and confirm no__nextHasNoMarginBottomviolations.__nextHasNoMarginBottomprop is no longer needed."