Skip to content

Commit 8796d23

Browse files
authored
Update no-deprecated-colors.md
1 parent bdf5718 commit 8796d23

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/rules/no-deprecated-colors.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Disallow references to deprecated color variables
2+
3+
4+
[Theming](https://primer.style/react/theming) in Primer React is made possible by a theme object that defines your application's colors, spacing, fonts, and more. The color variables in Primer React's default theme object are pulled from [Primer Primitives](). When a color variable is deprecated in Primer Primitives, it's important to remove references to that color variable before the variable removed from the library.
5+
6+
## Rule details
7+
8+
This rule disallows references to color variables that are deprecated in [Primer Primitives](https://github.com/primer/primitives).
9+
10+
11+
👎 Examples of **incorrect** code for this rule:
12+
13+
```jsx
14+
/* eslint no-deprecated-colors: "error" */
15+
import {Box, themeGet} from '@primer/components'
16+
import styled from 'styled-components'
17+
18+
const Example() = () => <Box color="some.deprecated.color">Incorrect</Box>
19+
20+
const StyledExample = styled.div`
21+
color: ${themeGet('some.deprecated.color')};
22+
`
23+
```
24+
25+
👍 Examples of **correct** code for this rule:
26+
27+
```jsx
28+
/* eslint no-deprecated-colors: "error" */
29+
import {Box, themeGet} from '@primer/components'
30+
import styled from 'styled-components'
31+
32+
const Example() = () => <Box color="some.color">Correct</Box>
33+
34+
const StyledExample = styled.div`
35+
color: ${themeGet('some.color')};
36+
`
37+
```

0 commit comments

Comments
 (0)