Skip to content

Commit

Permalink
[opinionated] Remove custom css_before_spread_props lint rule
Browse files Browse the repository at this point in the history
- As noted, Emotion does not auto-merge non-top-level props so we need to do it manually for css merging to work correctly.

This means a lot of disables - we're probably better off linting for the presence of `shouldRenderCustomStyles` instead, which actually tests for working Emotion CSS
  • Loading branch information
cee-chen committed Jun 30, 2023
1 parent 35224a8 commit 947fd6d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 302 deletions.
1 change: 0 additions & 1 deletion .eslintplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ exports.rules = {
'require-license-header': require('./scripts/eslint-plugin/require_license_header'),
'forward-ref': require('./scripts/eslint-plugin/forward_ref_display_name'),
'css-logical-properties': require('./scripts/eslint-plugin/css_logical_properties'),
css_before_spread_props: require('./scripts/eslint-plugin/css_before_spread_props'),
'require-cypress-references': require('./scripts/eslint-plugin/require_cypress_references'),
};
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ module.exports = {
'local/href-with-rel': 'error',
'local/forward-ref': 'error',
'local/css-logical-properties': 'error',
'local/css_before_spread_props': 'error',
'local/require-cypress-references': 'error',
'local/require-license-header': [
'warn',
Expand Down
48 changes: 0 additions & 48 deletions scripts/eslint-plugin/css_before_spread_props.js

This file was deleted.

248 changes: 0 additions & 248 deletions scripts/eslint-plugin/css_before_spread_props.test.js

This file was deleted.

5 changes: 1 addition & 4 deletions src/components/page/page_section/page_section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,11 @@ export const EuiPageSection: FunctionComponent<EuiPageSectionProps> = ({
bottomBorder === true && styles.border,
alignment.toLowerCase().includes('center') && contentStyles.center,
restrictWidth && contentStyles.restrictWidth,
contentProps?.css && contentProps.css,
contentProps?.css,
];

return (
<Component css={cssStyles} {...rest}>
{/* `css` must be merged manually after props spread on the content wrapper -
Emotion does not automatically correctly merge `css` on non-component JSX */}
{/* eslint-disable-next-line local/css_before_spread_props */}
<div {...contentProps} css={cssContentStyles} style={widthStyles}>
{children}
</div>
Expand Down

0 comments on commit 947fd6d

Please sign in to comment.