primer / eslint-plugin-primer-react

ESLint rules for Primer React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create a rule to disallow directly accessing themes from `sx` or styled system props

jfuchs opened this issue · comments

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" />

From planning: we should add docs to primer.style/react to warn against this usage.

Related to primer/react#2020. @siddharthkp when/if the ADR is merged, could you please take a look at this?