eslint-plugin-primer-react 0.7.1 → 0.7.2-rc.450e475
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -2
- package/docs/rules/no-deprecated-colors.md +5 -5
- package/docs/rules/no-system-props.md +3 -3
- package/package-lock.json +5631 -0
- package/package.json +1 -1
- package/src/rules/__tests__/no-deprecated-colors.test.js +36 -36
- package/src/rules/__tests__/no-system-props.test.js +30 -30
- package/src/rules/no-deprecated-colors.js +3 -3
- package/src/utils/is-primer-component.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# eslint-plugin-primer-react
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#24](https://github.com/primer/eslint-plugin-primer-react/pull/24) [`e5565ae`](https://github.com/primer/eslint-plugin-primer-react/commit/e5565ae890f55927c0b1dd96d8943efc1e0bbbfa) Thanks [@colebemis](https://github.com/colebemis)! - Replace references to `@primer/components` with `@primer/react`
|
|
8
|
+
|
|
3
9
|
## 0.7.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -36,7 +42,7 @@
|
|
|
36
42
|
|
|
37
43
|
```js
|
|
38
44
|
/* eslint primer-react/no-deprecated-colors: ["warn", {"checkAllStrings": true}] */
|
|
39
|
-
import {Box} from '@primer/
|
|
45
|
+
import {Box} from '@primer/react'
|
|
40
46
|
|
|
41
47
|
function ExampleComponent() {
|
|
42
48
|
const styles = {
|
|
@@ -51,7 +57,7 @@
|
|
|
51
57
|
|
|
52
58
|
### Patch Changes
|
|
53
59
|
|
|
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/
|
|
60
|
+
- [#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.
|
|
55
61
|
|
|
56
62
|
* [#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:
|
|
57
63
|
|
|
@@ -12,7 +12,7 @@ This rule disallows references to color variables that are deprecated in [Primer
|
|
|
12
12
|
|
|
13
13
|
```jsx
|
|
14
14
|
/* eslint primer-react/no-deprecated-colors: "error" */
|
|
15
|
-
import {Box, themeGet} from '@primer/
|
|
15
|
+
import {Box, themeGet} from '@primer/react'
|
|
16
16
|
import styled from 'styled-components'
|
|
17
17
|
|
|
18
18
|
const SystemPropExample() = () => <Box color="some.deprecated.color">Incorrect</Box>
|
|
@@ -30,7 +30,7 @@ const ThemeGetExample = styled.div`
|
|
|
30
30
|
|
|
31
31
|
```jsx
|
|
32
32
|
/* eslint primer-react/no-deprecated-colors: "error" */
|
|
33
|
-
import {Box, themeGet} from '@primer/
|
|
33
|
+
import {Box, themeGet} from '@primer/react'
|
|
34
34
|
import styled from 'styled-components'
|
|
35
35
|
|
|
36
36
|
const SystemPropExample() = () => <Box color="some.color">Correct</Box>
|
|
@@ -48,11 +48,11 @@ const ThemeGetExample = styled.div`
|
|
|
48
48
|
|
|
49
49
|
- `skipImportCheck` (default: `false`)
|
|
50
50
|
|
|
51
|
-
By default, the `no-deprecated-colors` rule will only check for deprecated colors used in functions and components that are imported from `@primer/
|
|
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.
|
|
52
52
|
|
|
53
53
|
```js
|
|
54
54
|
/* eslint primer-react/no-deprecated-colors: ["warn", {"skipImportCheck": true}] */
|
|
55
|
-
import {Box} from '@primer/
|
|
55
|
+
import {Box} from '@primer/react'
|
|
56
56
|
|
|
57
57
|
function MyBox({color, children}) {
|
|
58
58
|
return <Box color={color}>{children}</Box>
|
|
@@ -70,7 +70,7 @@ const ThemeGetExample = styled.div`
|
|
|
70
70
|
|
|
71
71
|
```js
|
|
72
72
|
/* eslint primer-react/no-deprecated-colors: ["warn", {"checkAllStrings": true}] */
|
|
73
|
-
import {Box} from '@primer/
|
|
73
|
+
import {Box} from '@primer/react'
|
|
74
74
|
|
|
75
75
|
function ExampleComponent() {
|
|
76
76
|
const styles = {
|
|
@@ -14,7 +14,7 @@ This rule disallows the use of any styled-system prop on Primer components, as t
|
|
|
14
14
|
|
|
15
15
|
```jsx
|
|
16
16
|
/* eslint primer-react/no-system-props: "error" */
|
|
17
|
-
import {Button} from '@primer/
|
|
17
|
+
import {Button} from '@primer/react'
|
|
18
18
|
|
|
19
19
|
<Button width={200} />
|
|
20
20
|
<Button width={200} sx={{height: 300}} />
|
|
@@ -24,7 +24,7 @@ import {Button} from '@primer/components'
|
|
|
24
24
|
|
|
25
25
|
```jsx
|
|
26
26
|
/* eslint primer-react/no-system-props: "error" */
|
|
27
|
-
import {Box, Button, ProgressBar} from '@primer/
|
|
27
|
+
import {Box, Button, ProgressBar} from '@primer/react'
|
|
28
28
|
import {Avatar} from 'some-other-library'
|
|
29
29
|
// Non-system props are allowed
|
|
30
30
|
<Button someOtherProp="foo" />
|
|
@@ -47,7 +47,7 @@ import {Avatar} from 'some-other-library'
|
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
49
|
/* eslint primer-react/no-system-props: ["warn", {"includeUtilityComponents": true}] */
|
|
50
|
-
import {Box} from '@primer/
|
|
50
|
+
import {Box} from '@primer/react'
|
|
51
51
|
|
|
52
52
|
function App() {
|
|
53
53
|
// Enabling `includeUtilityComponents` will find system prop usage on utility components like this:
|