Skip to content

Commit 0a83cfd

Browse files
authored
Replaces references to @primer/components with @primer/react
1 parent 895665e commit 0a83cfd

File tree

8 files changed

+81
-81
lines changed

8 files changed

+81
-81
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
```js
3838
/* eslint primer-react/no-deprecated-colors: ["warn", {"checkAllStrings": true}] */
39-
import {Box} from '@primer/components'
39+
import {Box} from '@primer/react'
4040

4141
function ExampleComponent() {
4242
const styles = {
@@ -51,7 +51,7 @@
5151

5252
### Patch Changes
5353

54-
- [#7](https://github.com/primer/eslint-plugin-primer-react/pull/7) [`d9dfb8d`](https://github.com/primer/eslint-plugin-primer-react/commit/d9dfb8de6d6dc42efe606517db7a0dd90d5c5578) Thanks [@colebemis](https://github.com/colebemis)! - Add `skipImportCheck` option. By default, the `no-deprecated-colors` rule will only check for deprecated colors used in functions and components that are imported from `@primer/components`. You can disable this behavior by setting `skipImportCheck` to `true`. This is useful for linting custom components that pass color-related props down to Primer React components.
54+
- [#7](https://github.com/primer/eslint-plugin-primer-react/pull/7) [`d9dfb8d`](https://github.com/primer/eslint-plugin-primer-react/commit/d9dfb8de6d6dc42efe606517db7a0dd90d5c5578) Thanks [@colebemis](https://github.com/colebemis)! - Add `skipImportCheck` option. By default, the `no-deprecated-colors` rule will only check for deprecated colors used in functions and components that are imported from `@primer/react`. You can disable this behavior by setting `skipImportCheck` to `true`. This is useful for linting custom components that pass color-related props down to Primer React components.
5555

5656
* [#6](https://github.com/primer/eslint-plugin-primer-react/pull/6) [`dd14594`](https://github.com/primer/eslint-plugin-primer-react/commit/dd14594b05e4d800baa76771f5b911d77352a983) Thanks [@colebemis](https://github.com/colebemis)! - The `no-deprecated-colors` rule can now find deprecated colors in the following cases:
5757

docs/rules/no-deprecated-colors.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This rule disallows references to color variables that are deprecated in [Primer
1212

1313
```jsx
1414
/* eslint primer-react/no-deprecated-colors: "error" */
15-
import {Box, themeGet} from '@primer/components'
15+
import {Box, themeGet} from '@primer/react'
1616
import styled from 'styled-components'
1717

1818
const SystemPropExample() = () => <Box color="some.deprecated.color">Incorrect</Box>
@@ -30,7 +30,7 @@ const ThemeGetExample = styled.div`
3030

3131
```jsx
3232
/* eslint primer-react/no-deprecated-colors: "error" */
33-
import {Box, themeGet} from '@primer/components'
33+
import {Box, themeGet} from '@primer/react'
3434
import styled from 'styled-components'
3535

3636
const SystemPropExample() = () => <Box color="some.color">Correct</Box>
@@ -48,11 +48,11 @@ const ThemeGetExample = styled.div`
4848

4949
- `skipImportCheck` (default: `false`)
5050

51-
By default, the `no-deprecated-colors` rule will only check for deprecated colors used in functions and components that are imported from `@primer/components`. You can disable this behavior by setting `skipImportCheck` to `true`. This is useful for linting custom components that pass color-related props down to Primer React components.
51+
By default, the `no-deprecated-colors` rule will only check for deprecated colors used in functions and components that are imported from `@primer/react`. You can disable this behavior by setting `skipImportCheck` to `true`. This is useful for linting custom components that pass color-related props down to Primer React components.
5252

5353
```js
5454
/* eslint primer-react/no-deprecated-colors: ["warn", {"skipImportCheck": true}] */
55-
import {Box} from '@primer/components'
55+
import {Box} from '@primer/react'
5656

5757
function MyBox({color, children}) {
5858
return <Box color={color}>{children}</Box>
@@ -70,7 +70,7 @@ const ThemeGetExample = styled.div`
7070

7171
```js
7272
/* eslint primer-react/no-deprecated-colors: ["warn", {"checkAllStrings": true}] */
73-
import {Box} from '@primer/components'
73+
import {Box} from '@primer/react'
7474

7575
function ExampleComponent() {
7676
const styles = {

docs/rules/no-system-props.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This rule disallows the use of any styled-system prop on Primer components, as t
1414

1515
```jsx
1616
/* eslint primer-react/no-system-props: "error" */
17-
import {Button} from '@primer/components'
17+
import {Button} from '@primer/react'
1818

1919
<Button width={200} />
2020
<Button width={200} sx={{height: 300}} />
@@ -24,7 +24,7 @@ import {Button} from '@primer/components'
2424

2525
```jsx
2626
/* eslint primer-react/no-system-props: "error" */
27-
import {Box, Button, ProgressBar} from '@primer/components'
27+
import {Box, Button, ProgressBar} from '@primer/react'
2828
import {Avatar} from 'some-other-library'
2929
// Non-system props are allowed
3030
<Button someOtherProp="foo" />
@@ -47,7 +47,7 @@ import {Avatar} from 'some-other-library'
4747

4848
```js
4949
/* eslint primer-react/no-system-props: ["warn", {"includeUtilityComponents": true}] */
50-
import {Box} from '@primer/components'
50+
import {Box} from '@primer/react'
5151

5252
function App() {
5353
// Enabling `includeUtilityComponents` will find system prop usage on utility components like this:

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/rules/__tests__/no-deprecated-colors.test.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ const ruleTester = new RuleTester({
2828
ruleTester.run('no-deprecated-colors', rule, {
2929
valid: [
3030
`import {Box} from '@other/design-system'; <Box color="text.primary">Hello</Box>`,
31-
`import {Box} from "@primer/components"; <Box color="fg.default">Hello</Box>`,
32-
`import {hello} from "@primer/components"; hello("colors.text.primary")`,
33-
`import {themeGet} from "@primer/components"; themeGet("space.text.primary")`,
34-
`import {themeGet} from "@primer/components"; themeGet(props.backgroundColorThemeValue)`,
35-
`import {themeGet} from "@primer/components"; themeGet(2)`,
31+
`import {Box} from "@primer/react"; <Box color="fg.default">Hello</Box>`,
32+
`import {hello} from "@primer/react"; hello("colors.text.primary")`,
33+
`import {themeGet} from "@primer/react"; themeGet("space.text.primary")`,
34+
`import {themeGet} from "@primer/react"; themeGet(props.backgroundColorThemeValue)`,
35+
`import {themeGet} from "@primer/react"; themeGet(2)`,
3636
`import {themeGet} from "@other/design-system"; themeGet("colors.text.primary")`,
3737
`import {get} from "@other/constants"; get("space.text.primary")`,
38-
`import {Box} from '@primer/components'; <Box sx={styles}>Hello</Box>`,
39-
`import {Box} from '@primer/components'; <Box sx={{color: text.primary}}>Hello</Box>`,
40-
`import {Box} from '@primer/components'; <Box sx={{color: "fg.default"}}>Hello</Box>`,
38+
`import {Box} from '@primer/react'; <Box sx={styles}>Hello</Box>`,
39+
`import {Box} from '@primer/react'; <Box sx={{color: text.primary}}>Hello</Box>`,
40+
`import {Box} from '@primer/react'; <Box sx={{color: "fg.default"}}>Hello</Box>`,
4141
`{color: 'text.primary'}`
4242
],
4343
invalid: [
@@ -52,8 +52,8 @@ ruleTester.run('no-deprecated-colors', rule, {
5252
]
5353
},
5454
{
55-
code: `import {Box} from "@primer/components"; function Example() { return <Box color="text.primary">Hello</Box> }`,
56-
output: `import {Box} from "@primer/components"; function Example() { return <Box color="fg.default">Hello</Box> }`,
55+
code: `import {Box} from "@primer/react"; function Example() { return <Box color="text.primary">Hello</Box> }`,
56+
output: `import {Box} from "@primer/react"; function Example() { return <Box color="fg.default">Hello</Box> }`,
5757
errors: [
5858
{
5959
message: '"text.primary" is deprecated. Use "fg.default" instead.'
@@ -71,97 +71,97 @@ ruleTester.run('no-deprecated-colors', rule, {
7171
]
7272
},
7373
{
74-
code: `import Box from '@primer/components/lib-esm/Box'; function Example() { return <Box color="text.primary">Hello</Box> }`,
75-
output: `import Box from '@primer/components/lib-esm/Box'; function Example() { return <Box color="fg.default">Hello</Box> }`,
74+
code: `import Box from '@primer/react/lib-esm/Box'; function Example() { return <Box color="text.primary">Hello</Box> }`,
75+
output: `import Box from '@primer/react/lib-esm/Box'; function Example() { return <Box color="fg.default">Hello</Box> }`,
7676
errors: [
7777
{
7878
message: '"text.primary" is deprecated. Use "fg.default" instead.'
7979
}
8080
]
8181
},
8282
{
83-
code: `import {Box} from "@primer/components"; const Example = () => <Box color="text.primary">Hello</Box>`,
84-
output: `import {Box} from "@primer/components"; const Example = () => <Box color="fg.default">Hello</Box>`,
83+
code: `import {Box} from "@primer/react"; const Example = () => <Box color="text.primary">Hello</Box>`,
84+
output: `import {Box} from "@primer/react"; const Example = () => <Box color="fg.default">Hello</Box>`,
8585
errors: [
8686
{
8787
message: '"text.primary" is deprecated. Use "fg.default" instead.'
8888
}
8989
]
9090
},
9191
{
92-
code: `import {Box} from "@primer/components"; <Box bg="bg.primary" m={1} />`,
93-
output: `import {Box} from "@primer/components"; <Box bg="canvas.default" m={1} />`,
92+
code: `import {Box} from "@primer/react"; <Box bg="bg.primary" m={1} />`,
93+
output: `import {Box} from "@primer/react"; <Box bg="canvas.default" m={1} />`,
9494
errors: [
9595
{
9696
message: '"bg.primary" is deprecated. Use "canvas.default" instead.'
9797
}
9898
]
9999
},
100100
{
101-
code: `import {Box} from "@primer/components"; <Box sx={{bg: "bg.primary", m: 1, ...rest}} />`,
102-
output: `import {Box} from "@primer/components"; <Box sx={{bg: "canvas.default", m: 1, ...rest}} />`,
101+
code: `import {Box} from "@primer/react"; <Box sx={{bg: "bg.primary", m: 1, ...rest}} />`,
102+
output: `import {Box} from "@primer/react"; <Box sx={{bg: "canvas.default", m: 1, ...rest}} />`,
103103
errors: [
104104
{
105105
message: '"bg.primary" is deprecated. Use "canvas.default" instead.'
106106
}
107107
]
108108
},
109109
{
110-
code: `import {Box} from "@primer/components"; <Box sx={{boxShadow: theme => theme.shadows.autocomplete.shadow}} />`,
111-
output: `import {Box} from "@primer/components"; <Box sx={{boxShadow: theme => theme.shadows.shadow.medium}} />`,
110+
code: `import {Box} from "@primer/react"; <Box sx={{boxShadow: theme => theme.shadows.autocomplete.shadow}} />`,
111+
output: `import {Box} from "@primer/react"; <Box sx={{boxShadow: theme => theme.shadows.shadow.medium}} />`,
112112
errors: [
113113
{
114114
message: '"theme.shadows.autocomplete.shadow" is deprecated. Use "theme.shadows.shadow.medium" instead.'
115115
}
116116
]
117117
},
118118
{
119-
code: `import {Box} from "@primer/components"; <Box sx={{boxShadow: theme => \`0 1px 2px \${theme.colors.text.primary}\`}} />`,
120-
output: `import {Box} from "@primer/components"; <Box sx={{boxShadow: theme => \`0 1px 2px \${theme.colors.fg.default}\`}} />`,
119+
code: `import {Box} from "@primer/react"; <Box sx={{boxShadow: theme => \`0 1px 2px \${theme.colors.text.primary}\`}} />`,
120+
output: `import {Box} from "@primer/react"; <Box sx={{boxShadow: theme => \`0 1px 2px \${theme.colors.fg.default}\`}} />`,
121121
errors: [
122122
{
123123
message: '"theme.colors.text.primary" is deprecated. Use "theme.colors.fg.default" instead.'
124124
}
125125
]
126126
},
127127
{
128-
code: `import {Box} from "@primer/components"; <Box sx={{boxShadow: t => \`0 1px 2px \${t.colors.text.primary}\`}} />`,
129-
output: `import {Box} from "@primer/components"; <Box sx={{boxShadow: t => \`0 1px 2px \${t.colors.fg.default}\`}} />`,
128+
code: `import {Box} from "@primer/react"; <Box sx={{boxShadow: t => \`0 1px 2px \${t.colors.text.primary}\`}} />`,
129+
output: `import {Box} from "@primer/react"; <Box sx={{boxShadow: t => \`0 1px 2px \${t.colors.fg.default}\`}} />`,
130130
errors: [
131131
{
132132
message: '"t.colors.text.primary" is deprecated. Use "t.colors.fg.default" instead.'
133133
}
134134
]
135135
},
136136
{
137-
code: `import {Box} from "@primer/components"; <Box sx={{"&:hover": {bg: "bg.primary"}}} />`,
138-
output: `import {Box} from "@primer/components"; <Box sx={{"&:hover": {bg: "canvas.default"}}} />`,
137+
code: `import {Box} from "@primer/react"; <Box sx={{"&:hover": {bg: "bg.primary"}}} />`,
138+
output: `import {Box} from "@primer/react"; <Box sx={{"&:hover": {bg: "canvas.default"}}} />`,
139139
errors: [
140140
{
141141
message: '"bg.primary" is deprecated. Use "canvas.default" instead.'
142142
}
143143
]
144144
},
145145
{
146-
code: `import {Box} from "@primer/components"; <Box color="auto.green.5" />`,
146+
code: `import {Box} from "@primer/react"; <Box color="auto.green.5" />`,
147147
errors: [
148148
{
149149
message: '"auto.green.5" is deprecated.',
150150
suggestions: [
151151
{
152152
desc: 'Use "success.fg" instead.',
153-
output: `import {Box} from "@primer/components"; <Box color="success.fg" />`
153+
output: `import {Box} from "@primer/react"; <Box color="success.fg" />`
154154
},
155155
{
156156
desc: 'Use "success.emphasis" instead.',
157-
output: `import {Box} from "@primer/components"; <Box color="success.emphasis" />`
157+
output: `import {Box} from "@primer/react"; <Box color="success.emphasis" />`
158158
}
159159
]
160160
}
161161
]
162162
},
163163
{
164-
code: `import {Box} from "@primer/components"; <Box color="fade.fg10" />`,
164+
code: `import {Box} from "@primer/react"; <Box color="fade.fg10" />`,
165165
errors: [
166166
{
167167
message:
@@ -170,8 +170,8 @@ ruleTester.run('no-deprecated-colors', rule, {
170170
]
171171
},
172172
{
173-
code: `import {Box, Text} from "@primer/components"; <Box bg="bg.primary"><Text color="text.primary">Hello</Text></Box>`,
174-
output: `import {Box, Text} from "@primer/components"; <Box bg="canvas.default"><Text color="fg.default">Hello</Text></Box>`,
173+
code: `import {Box, Text} from "@primer/react"; <Box bg="bg.primary"><Text color="text.primary">Hello</Text></Box>`,
174+
output: `import {Box, Text} from "@primer/react"; <Box bg="canvas.default"><Text color="fg.default">Hello</Text></Box>`,
175175
errors: [
176176
{
177177
message: '"bg.primary" is deprecated. Use "canvas.default" instead.'
@@ -182,17 +182,17 @@ ruleTester.run('no-deprecated-colors', rule, {
182182
]
183183
},
184184
{
185-
code: `import {themeGet} from "@primer/components"; themeGet("colors.text.primary")`,
186-
output: `import {themeGet} from "@primer/components"; themeGet("colors.fg.default")`,
185+
code: `import {themeGet} from "@primer/react"; themeGet("colors.text.primary")`,
186+
output: `import {themeGet} from "@primer/react"; themeGet("colors.fg.default")`,
187187
errors: [
188188
{
189189
message: '"colors.text.primary" is deprecated. Use "colors.fg.default" instead.'
190190
}
191191
]
192192
},
193193
{
194-
code: `import {themeGet} from "@primer/components"; themeGet("shadows.autocomplete.shadow")`,
195-
output: `import {themeGet} from "@primer/components"; themeGet("shadows.shadow.medium")`,
194+
code: `import {themeGet} from "@primer/react"; themeGet("shadows.autocomplete.shadow")`,
195+
output: `import {themeGet} from "@primer/react"; themeGet("shadows.shadow.medium")`,
196196
errors: [
197197
{
198198
message: '"shadows.autocomplete.shadow" is deprecated. Use "shadows.shadow.medium" instead.'

0 commit comments

Comments
 (0)