@atlaskit/eslint-plugin-ui-styling-standard 0.11.5 → 0.11.6
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 -0
- package/README.md +10 -7
- package/constellation/atlaskit-theme/usage.mdx +113 -0
- package/constellation/convert-props-syntax/usage.mdx +32 -22
- package/constellation/enforce-style-prop/usage.mdx +21 -18
- package/constellation/index/overview.mdx +91 -76
- package/constellation/local-cx-xcss/usage.mdx +10 -6
- package/constellation/no-array-arguments/usage.mdx +10 -9
- package/constellation/no-classname-prop/usage.mdx +7 -4
- package/constellation/no-container-queries/usage.mdx +17 -15
- package/constellation/no-dynamic-styles/usage.mdx +26 -29
- package/constellation/no-exported-styles/usage.mdx +23 -18
- package/constellation/no-important-styles/usage.mdx +5 -3
- package/constellation/no-imported-style-values/usage.mdx +30 -22
- package/constellation/no-nested-selectors/usage.mdx +22 -20
- package/constellation/no-unsafe-values/usage.mdx +45 -51
- package/dist/cjs/index.codegen.js +1 -1
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/presets/recommended.codegen.js +2 -1
- package/dist/cjs/rules/atlaskit-theme/index.js +95 -0
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/es2019/index.codegen.js +1 -1
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/presets/recommended.codegen.js +2 -1
- package/dist/es2019/rules/atlaskit-theme/index.js +85 -0
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/esm/index.codegen.js +1 -1
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/presets/recommended.codegen.js +2 -1
- package/dist/esm/rules/atlaskit-theme/index.js +89 -0
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/types/index.codegen.d.ts +2 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/presets/recommended.codegen.d.ts +2 -1
- package/dist/types/rules/atlaskit-theme/index.d.ts +3 -0
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/atlaskit-theme/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/package.json +2 -2
- package/src/index.codegen.tsx +3 -3
- package/src/presets/all.codegen.tsx +66 -69
- package/src/presets/recommended.codegen.tsx +66 -69
- package/src/rules/atlaskit-theme/README.md +109 -0
- package/src/rules/atlaskit-theme/__tests__/test.ts +122 -0
- package/src/rules/atlaskit-theme/index.ts +136 -0
- package/src/rules/index.codegen.tsx +15 -13
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
This rule prevents usage of the `className` prop in JSX.
|
|
4
4
|
|
|
5
|
-
Avoid `className` because it invites the use of unsafe global styles and is impossible to determine
|
|
5
|
+
Avoid `className` because it invites the use of unsafe global styles and is impossible to determine
|
|
6
|
+
via local tooling. Use props for configuration and typical CSS-in-JS for styling or `xcss` for
|
|
7
|
+
bounded overrides.
|
|
6
8
|
|
|
7
9
|
## Examples
|
|
8
10
|
|
|
@@ -32,7 +34,8 @@ import { css } from '@compiled/react';
|
|
|
32
34
|
|
|
33
35
|
### What if I'm using `className` to target elements with JavaScript?
|
|
34
36
|
|
|
35
|
-
There are some cases where a selector is required to integrate with a 3rd party library,
|
|
36
|
-
|
|
37
|
+
There are some cases where a selector is required to integrate with a 3rd party library, such as
|
|
38
|
+
legacy code using jQuery.
|
|
37
39
|
|
|
38
|
-
Use a `ref` if possible. Otherwise, if you _must_ have a selector, use a `data-*` attribute that
|
|
40
|
+
Use a `ref` if possible. Otherwise, if you _must_ have a selector, use a `data-*` attribute that
|
|
41
|
+
gives enough context and is unique enough, for example `data-editor-table-target="true"`.
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This rule prevents the usage of the `@container` query in style declarations.
|
|
4
4
|
|
|
5
|
-
Container queries break the rules of scope and aren’t guaranteed to be deterministic or type safe
|
|
5
|
+
Container queries break the rules of scope and aren’t guaranteed to be deterministic or type safe
|
|
6
|
+
and isn’t fully supported across our frontend tech stacks.
|
|
6
7
|
|
|
7
8
|
We suggest you explore the use alternatives such as client JavaScript-based APIs or media queries.
|
|
8
9
|
|
|
@@ -14,11 +15,11 @@ We suggest you explore the use alternatives such as client JavaScript-based APIs
|
|
|
14
15
|
import { css } from '@compiled/react';
|
|
15
16
|
|
|
16
17
|
const styles = css({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
'@container (width > 400px)': {
|
|
19
|
+
h2: {
|
|
20
|
+
fontSize: '1.5rem',
|
|
21
|
+
},
|
|
20
22
|
},
|
|
21
|
-
},
|
|
22
23
|
});
|
|
23
24
|
```
|
|
24
25
|
|
|
@@ -28,8 +29,8 @@ const styles = css({
|
|
|
28
29
|
import { css } from '@compiled/react';
|
|
29
30
|
|
|
30
31
|
const containerStyles = css({
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
33
34
|
});
|
|
34
35
|
```
|
|
35
36
|
|
|
@@ -39,12 +40,13 @@ const containerStyles = css({
|
|
|
39
40
|
|
|
40
41
|
By default, this rule will check `css` usages from:
|
|
41
42
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
43
|
+
- `@atlaskit/css`
|
|
44
|
+
- `@atlaskit/primitives`
|
|
45
|
+
- `@compiled/react`
|
|
46
|
+
- `@emotion/react`
|
|
47
|
+
- `@emotion/core`
|
|
48
|
+
- `@emotion/styled`
|
|
49
|
+
- `styled-components`
|
|
49
50
|
|
|
50
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
51
|
+
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
52
|
+
array of package names (strings).
|
|
@@ -4,9 +4,9 @@ This rule prevents the use of dynamic styles (function expressions) in style dec
|
|
|
4
4
|
|
|
5
5
|
This ensures that style declarations:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
7
|
+
- are statically analyzable
|
|
8
|
+
- can be efficiently extracted into atomic CSS
|
|
9
|
+
- are more readable, deterministic, and thus easier to maintain
|
|
10
10
|
|
|
11
11
|
## Examples
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ This ensures that style declarations:
|
|
|
16
16
|
import { styled } from '@compiled/react';
|
|
17
17
|
|
|
18
18
|
const Component = styled.div<{ width: number }>((props) => ({
|
|
19
|
-
|
|
19
|
+
width: props.width,
|
|
20
20
|
}));
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -24,7 +24,7 @@ const Component = styled.div<{ width: number }>((props) => ({
|
|
|
24
24
|
import styled from 'styled-components';
|
|
25
25
|
|
|
26
26
|
const Component = styled.div<{ width: number }>({
|
|
27
|
-
|
|
27
|
+
width: (props) => props.width,
|
|
28
28
|
});
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -32,8 +32,7 @@ const Component = styled.div<{ width: number }>({
|
|
|
32
32
|
import styled from 'styled-components';
|
|
33
33
|
|
|
34
34
|
const Container = styled.div<hasPadding>({
|
|
35
|
-
|
|
36
|
-
hasPadding ? token('space.100', '8px') : token('space.0', '0px'),
|
|
35
|
+
padding: ({ hasPadding }) => (hasPadding ? token('space.100', '8px') : token('space.0', '0px')),
|
|
37
36
|
});
|
|
38
37
|
```
|
|
39
38
|
|
|
@@ -41,8 +40,8 @@ const Container = styled.div<hasPadding>({
|
|
|
41
40
|
|
|
42
41
|
**Flags**
|
|
43
42
|
|
|
44
|
-
If you have a style that is on/off depending on a prop,
|
|
45
|
-
|
|
43
|
+
If you have a style that is on/off depending on a prop, use the `css` prop to conditionally apply
|
|
44
|
+
it.
|
|
46
45
|
|
|
47
46
|
```tsx
|
|
48
47
|
import { css } from '@compiled/react';
|
|
@@ -51,14 +50,14 @@ const baseStyles = css({ padding: token('space.0') });
|
|
|
51
50
|
const hasPaddingStyles = css({ padding: token('space.100') });
|
|
52
51
|
|
|
53
52
|
const Container = ({ hasPadding = false }: { hasPadding?: boolean }) => {
|
|
54
|
-
|
|
53
|
+
return <div css={[baseStyles, hasPadding && hasPaddingStyles]} />;
|
|
55
54
|
};
|
|
56
55
|
```
|
|
57
56
|
|
|
58
57
|
**Variants**
|
|
59
58
|
|
|
60
|
-
If you have variants which are known ahead of time,
|
|
61
|
-
|
|
59
|
+
If you have variants which are known ahead of time, use `cssMap` to define them and the `css` prop
|
|
60
|
+
to conditionally apply it.
|
|
62
61
|
|
|
63
62
|
```tsx
|
|
64
63
|
import { css } from '@compiled/react';
|
|
@@ -82,8 +81,7 @@ const Wrapper = ({ appearance = 'primary' }: { appearance?: 'primary' | 'error'
|
|
|
82
81
|
|
|
83
82
|
**Dynamic values**
|
|
84
83
|
|
|
85
|
-
If you have styles which are truly dynamic,
|
|
86
|
-
use the `style` prop.
|
|
84
|
+
If you have styles which are truly dynamic, use the `style` prop.
|
|
87
85
|
|
|
88
86
|
This approach should be used as a last resort.
|
|
89
87
|
|
|
@@ -91,7 +89,7 @@ This approach should be used as a last resort.
|
|
|
91
89
|
import { css } from '@compiled/react';
|
|
92
90
|
|
|
93
91
|
const Component = ({ width }: { width: number }) => {
|
|
94
|
-
|
|
92
|
+
return <div style={{ width }} />;
|
|
95
93
|
};
|
|
96
94
|
```
|
|
97
95
|
|
|
@@ -99,15 +97,13 @@ const Component = ({ width }: { width: number }) => {
|
|
|
99
97
|
import { css } from '@compiled/react';
|
|
100
98
|
|
|
101
99
|
const containerStyles = css({
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
'::before': {
|
|
101
|
+
width: 'var(--ak-example-width)',
|
|
102
|
+
},
|
|
105
103
|
});
|
|
106
104
|
|
|
107
105
|
function Example({ width }: { width: number }) {
|
|
108
|
-
|
|
109
|
-
<div css={containerStyles} style={{ '--ak-example-width': `${width}px` }} />
|
|
110
|
-
);
|
|
106
|
+
return <div css={containerStyles} style={{ '--ak-example-width': `${width}px` }} />;
|
|
111
107
|
}
|
|
112
108
|
```
|
|
113
109
|
|
|
@@ -117,12 +113,13 @@ function Example({ width }: { width: number }) {
|
|
|
117
113
|
|
|
118
114
|
By default, this rule will check usages from:
|
|
119
115
|
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
116
|
+
- `@atlaskit/css`
|
|
117
|
+
- `@atlaskit/primitives`
|
|
118
|
+
- `@compiled/react`
|
|
119
|
+
- `@emotion/react`
|
|
120
|
+
- `@emotion/core`
|
|
121
|
+
- `@emotion/styled`
|
|
122
|
+
- `styled-components`
|
|
127
123
|
|
|
128
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
124
|
+
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
125
|
+
array of package names (strings).
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
This rule disallows exports of `css`, `cssMap`, `keyframes`, `styled`, `xcss` styles.
|
|
4
4
|
|
|
5
|
-
Exporting style declarations from these libraries may result in unexpected errors when imported,
|
|
5
|
+
Exporting style declarations from these libraries may result in unexpected errors when imported,
|
|
6
|
+
because its value will be null at runtime. Additionally, co-locating style definitions with their
|
|
7
|
+
usage is considered best practice in order to improve code readability and build performance.
|
|
6
8
|
|
|
7
9
|
## Examples
|
|
8
10
|
|
|
@@ -24,12 +26,13 @@ export const animation = keyframes({});
|
|
|
24
26
|
export default keyframes({});
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
Avoid exporting any style-like objects or values for consumption as well as these will violate our
|
|
29
|
+
Avoid exporting any style-like objects or values for consumption as well as these will violate our
|
|
30
|
+
`no-imported-style-values` rule which blocks consumption of imported styles.
|
|
28
31
|
|
|
29
32
|
```js
|
|
30
33
|
export default {
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
color: 'red',
|
|
35
|
+
margin: '0px',
|
|
33
36
|
};
|
|
34
37
|
```
|
|
35
38
|
|
|
@@ -37,15 +40,15 @@ export default {
|
|
|
37
40
|
import { css } from '@compiled/react';
|
|
38
41
|
|
|
39
42
|
const color = css({
|
|
40
|
-
|
|
43
|
+
/* */
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
const styles = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
primary: {
|
|
48
|
+
text: {
|
|
49
|
+
color,
|
|
50
|
+
},
|
|
47
51
|
},
|
|
48
|
-
},
|
|
49
52
|
};
|
|
50
53
|
|
|
51
54
|
export default styles.primary.text.color;
|
|
@@ -53,7 +56,8 @@ export default styles.primary.text.color;
|
|
|
53
56
|
|
|
54
57
|
### Correct
|
|
55
58
|
|
|
56
|
-
Co-locate your styles next to your components to improve code readability, linting, and build
|
|
59
|
+
Co-locate your styles next to your components to improve code readability, linting, and build
|
|
60
|
+
performance.
|
|
57
61
|
|
|
58
62
|
```js
|
|
59
63
|
import { css } from '@compiled/react';
|
|
@@ -76,12 +80,13 @@ export const Component = ({ children }) => <div css={styles}>{children}></div>;
|
|
|
76
80
|
|
|
77
81
|
By default, this rule will check `css` usages from:
|
|
78
82
|
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
83
|
+
- `@atlaskit/css`
|
|
84
|
+
- `@atlaskit/primitives`
|
|
85
|
+
- `@compiled/react`
|
|
86
|
+
- `@emotion/react`
|
|
87
|
+
- `@emotion/core`
|
|
88
|
+
- `@emotion/styled`
|
|
89
|
+
- `styled-components`
|
|
86
90
|
|
|
87
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
91
|
+
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
92
|
+
array of package names (strings).
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
This rule prevents the usage of the `!important` flag in style declarations.
|
|
4
4
|
|
|
5
|
-
Properly composed styles will never need an `!important` flag. It is used to override specificity
|
|
5
|
+
Properly composed styles will never need an `!important` flag. It is used to override specificity
|
|
6
|
+
when working across different scopes, and the UI Styling Standard enforces styles with minimal
|
|
7
|
+
scope.
|
|
6
8
|
|
|
7
9
|
The use of `!important` is a code smell and greatly impacts readability and determinism.
|
|
8
10
|
|
|
@@ -14,7 +16,7 @@ The use of `!important` is a code smell and greatly impacts readability and dete
|
|
|
14
16
|
import { css } from '@compiled/react';
|
|
15
17
|
|
|
16
18
|
const styles = css({
|
|
17
|
-
|
|
19
|
+
color: 'red!important',
|
|
18
20
|
});
|
|
19
21
|
```
|
|
20
22
|
|
|
@@ -24,6 +26,6 @@ const styles = css({
|
|
|
24
26
|
import { css } from '@compiled/react';
|
|
25
27
|
|
|
26
28
|
const styles = css({
|
|
27
|
-
|
|
29
|
+
color: 'red',
|
|
28
30
|
});
|
|
29
31
|
```
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# no-imported-style-values
|
|
2
2
|
|
|
3
|
-
This rule disallows using imported style values in `css`, `cssMap`, `styled`, `keyframes` and `xcss`
|
|
3
|
+
This rule disallows using imported style values in `css`, `cssMap`, `styled`, `keyframes` and `xcss`
|
|
4
|
+
calls.
|
|
4
5
|
|
|
5
|
-
Importing style values may result in unexpected errors when used in these APIs, because its value
|
|
6
|
+
Importing style values may result in unexpected errors when used in these APIs, because its value
|
|
7
|
+
will be null at runtime when using `@compiled/react`. Additionally, co-locating style definitions
|
|
8
|
+
with their usage is considered best practice in order to improve code readability and build
|
|
9
|
+
performance.
|
|
6
10
|
|
|
7
11
|
## Examples
|
|
8
12
|
|
|
@@ -13,8 +17,8 @@ import { css } from '@compiled/react';
|
|
|
13
17
|
import { colors, getColor } from '@mui/theme';
|
|
14
18
|
|
|
15
19
|
const styles = css({
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
[colorKey]: getColor('red'),
|
|
21
|
+
background: colors['red'],
|
|
18
22
|
});
|
|
19
23
|
```
|
|
20
24
|
|
|
@@ -26,10 +30,10 @@ import { ff } from '@atlaskit/ff';
|
|
|
26
30
|
const sharedObject = { padding: 0 };
|
|
27
31
|
|
|
28
32
|
const styles = css({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
...cssShared,
|
|
34
|
+
...sharedObject,
|
|
35
|
+
height: `${HEIGHT}px`,
|
|
36
|
+
width: ff('…') ? `${HEIGHT}px` : undefined,
|
|
33
37
|
});
|
|
34
38
|
```
|
|
35
39
|
|
|
@@ -40,7 +44,7 @@ import { css } from '@compiled/react';
|
|
|
40
44
|
import { buttonStyles } from '../shared';
|
|
41
45
|
|
|
42
46
|
const styles = css({
|
|
43
|
-
|
|
47
|
+
color: 'red',
|
|
44
48
|
});
|
|
45
49
|
|
|
46
50
|
export default () => <div css={[styles, buttonStyles]} />;
|
|
@@ -56,15 +60,16 @@ export default () => <div style={{ width: importedWidth }} />;
|
|
|
56
60
|
|
|
57
61
|
### Correct
|
|
58
62
|
|
|
59
|
-
Co-locate your styles next to your components to improve code readability, linting, and build
|
|
63
|
+
Co-locate your styles next to your components to improve code readability, linting, and build
|
|
64
|
+
performance.
|
|
60
65
|
|
|
61
66
|
```js
|
|
62
67
|
import { css } from '@compiled/react';
|
|
63
68
|
import { token } from '@atlaskit/tokens';
|
|
64
69
|
|
|
65
70
|
const styles = css({
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
color: 'red',
|
|
72
|
+
padding: token('space.150'),
|
|
68
73
|
});
|
|
69
74
|
export const Component = ({ children }) => <div css={styles}>{children}></div>;
|
|
70
75
|
```
|
|
@@ -83,7 +88,8 @@ export const Component = ({ children }) => <div css={styles}>{children}></div>;
|
|
|
83
88
|
|
|
84
89
|
Use this to allow specified imports as dynamic keys, in addition to the built-in allow-list.
|
|
85
90
|
|
|
86
|
-
Each value should be a two-element array. The first item is the entrypoint, and the second item is a
|
|
91
|
+
Each value should be a two-element array. The first item is the entrypoint, and the second item is a
|
|
92
|
+
named export.
|
|
87
93
|
|
|
88
94
|
Default imports are not supported.
|
|
89
95
|
|
|
@@ -109,7 +115,8 @@ Default imports are not supported.
|
|
|
109
115
|
|
|
110
116
|
Use this to allow specific functions to be called, in addition to the built-in allow-list.
|
|
111
117
|
|
|
112
|
-
Each value should be a two-element array. The first item is the entrypoint, and the second item is a
|
|
118
|
+
Each value should be a two-element array. The first item is the entrypoint, and the second item is a
|
|
119
|
+
named export.
|
|
113
120
|
|
|
114
121
|
Default imports are not currently supported.
|
|
115
122
|
|
|
@@ -135,12 +142,13 @@ Default imports are not currently supported.
|
|
|
135
142
|
|
|
136
143
|
By default, this rule will check `css` usages from:
|
|
137
144
|
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
+
- `@atlaskit/css`
|
|
146
|
+
- `@atlaskit/primitives`
|
|
147
|
+
- `@compiled/react`
|
|
148
|
+
- `@emotion/react`
|
|
149
|
+
- `@emotion/core`
|
|
150
|
+
- `@emotion/styled`
|
|
151
|
+
- `styled-components`
|
|
145
152
|
|
|
146
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
153
|
+
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
154
|
+
array of package names (strings).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# no-nested-selectors
|
|
2
2
|
|
|
3
|
-
This rule prevents the usage of the nested selectors in style declarations. Avoid setting styles for
|
|
3
|
+
This rule prevents the usage of the nested selectors in style declarations. Avoid setting styles for
|
|
4
|
+
any child elements or elements that require context from other elements.
|
|
4
5
|
|
|
5
6
|
## Examples
|
|
6
7
|
|
|
@@ -9,27 +10,27 @@ This rule prevents the usage of the nested selectors in style declarations. Avoi
|
|
|
9
10
|
```js
|
|
10
11
|
import { css } from '@compiled/react';
|
|
11
12
|
const styles = css({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
h2: {
|
|
14
|
+
fontSize: '1.5rem',
|
|
15
|
+
},
|
|
15
16
|
});
|
|
16
17
|
```
|
|
17
18
|
|
|
18
19
|
```js
|
|
19
20
|
import { styled } from '@compiled/react';
|
|
20
21
|
const Component = styled.div({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
'*': {
|
|
23
|
+
padding: 0,
|
|
24
|
+
},
|
|
24
25
|
});
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
```js
|
|
28
29
|
import { styled } from '@compiled/react';
|
|
29
30
|
const Component = styled.div({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
'.myclass': {
|
|
32
|
+
padding: 0,
|
|
33
|
+
},
|
|
33
34
|
});
|
|
34
35
|
```
|
|
35
36
|
|
|
@@ -38,8 +39,8 @@ const Component = styled.div({
|
|
|
38
39
|
```js
|
|
39
40
|
import { css } from '@compiled/react';
|
|
40
41
|
const styles = css({
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'column',
|
|
43
44
|
});
|
|
44
45
|
```
|
|
45
46
|
|
|
@@ -49,12 +50,13 @@ const styles = css({
|
|
|
49
50
|
|
|
50
51
|
By default, this rule will check `css` usages from:
|
|
51
52
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
53
|
+
- `@atlaskit/css`
|
|
54
|
+
- `@atlaskit/primitives`
|
|
55
|
+
- `@compiled/react`
|
|
56
|
+
- `@emotion/react`
|
|
57
|
+
- `@emotion/core`
|
|
58
|
+
- `@emotion/styled`
|
|
59
|
+
- `styled-components`
|
|
59
60
|
|
|
60
|
-
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
61
|
+
To change this list of libraries, you can define a custom set of `importSources`, which accepts an
|
|
62
|
+
array of package names (strings).
|