diff --git a/.eslintrc.js b/.eslintrc.js index 7925bceafd3d57..c15afbcf02aa93 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -277,6 +277,31 @@ module.exports = { ], }, }, + { + // Temporary rules until we're ready to officially deprecate the bottom margins. + files: [ 'packages/*/src/**/*.[tj]s?(x)' ], + excludedFiles: [ + 'packages/components/src/**/@(test|stories)/**', + '**/*.@(native|ios|android).js', + ], + rules: { + 'no-restricted-syntax': [ + 'error', + ...restrictedSyntax, + ...restrictedSyntaxComponents, + ...[ + 'FocalPointPicker', + 'TextareaControl', + 'TreeSelect', + ].map( ( componentName ) => ( { + selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__nextHasNoMarginBottom"]))`, + message: + componentName + + ' should have the `__nextHasNoMarginBottom` prop to opt-in to the new margin-free styles.', + } ) ), + ], + }, + }, { files: [ // Components package. diff --git a/packages/components/src/focal-point-picker/README.md b/packages/components/src/focal-point-picker/README.md index 9abb147831409a..f5db4885fdf7a4 100644 --- a/packages/components/src/focal-point-picker/README.md +++ b/packages/components/src/focal-point-picker/README.md @@ -28,6 +28,7 @@ const Example = () => { return ( <> * { return ( { return ( setPage( newPage ) } @@ -89,3 +90,11 @@ An array containing the tree objects with the possible nodes the user can select - Type: `Object[]` - Required: No + +#### __nextHasNoMarginBottom + +Start opting into the new margin-free styles that will become the default in a future version. + +- Type: `Boolean` +- Required: No +- Default: `false` diff --git a/packages/components/src/tree-select/index.tsx b/packages/components/src/tree-select/index.tsx index d6e0738b6beb37..626fb0fda3a01c 100644 --- a/packages/components/src/tree-select/index.tsx +++ b/packages/components/src/tree-select/index.tsx @@ -37,6 +37,7 @@ function getSelectOptions( * * return ( * setPage( newPage ) }