Create a rule to disallow directly accessing themes from `sx` or styled system props
jfuchs opened this issue · comments
Jonathan Fuchs commented
A no-theme-access-out-of-context rule would keep you from doing this:
import {theme, Box} from '@primer/components'
<Box width={theme.sizes.large} />
And auto-fix it to:
<Box width="large" />
Diana Mounter commented
From planning: we should add docs to primer.style/react to warn against this usage.
Leslie Cohn-Wein commented
Related to primer/react#2020. @siddharthkp when/if the ADR is merged, could you please take a look at this?