Skip to content
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

chore: add a new eslint rule prevent using margin #17024

Draft
wants to merge 2 commits into
base: edge
Choose a base branch
from

Conversation

koji
Copy link
Contributor

@koji koji commented Dec 3, 2024

Overview

add a new eslint rule prevent using margin
The new rules will show warnings when you use margins (inline & css-in-js).

why do we need this?

when we work on responsiveness, margins make things difficult.

https://mxstbr.com/thoughts/margin
https://www.joshwcomeau.com/css/rules-of-margin-collapse/

In addition, generally the design team doesn't use margins since they use Figma's Auto layout that uses padding and gap to create a layout.

bad cases

# inline case1
<StyledText marginLeft={SPACING.spacing4}>{'test'}</StyledText>

# inline case2
<Flex style={{ marginBottom: '1rem' }}>
  <StyledText>{'test'}</StyledText>
  <StyledText>{'test'}</StyledText>
</Flex>

# css-in-js case
const BAD_STYLE = css`
  margin-top: 1rem;
  margin-left: 1rem;
`

VSCode
https://opentrons.slack.com/archives/CSCLVUW3C/p1733182307004269

close AUTH-

Test Plan and Hands on Testing

Changelog

  • add js files for the new custom eslint rules

Review requests

Risk assessment

low

add a new eslint rule prevent using margin

close AUTH-
@koji
Copy link
Contributor Author

koji commented Dec 5, 2024

  • unify css styling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant